public SmartController EditController(SmartController input)
        {
            var controller = Controllers.Where(x => x.Id == input.Id).FirstOrDefault();

            if (controller == null)
            {
                throw new Exception("Сценарий с таким Id не обнаружен");
            }
            if (input.Name != null)
            {
                controller.Name = input.Name;
            }
            if (input.Description != null)
            {
                controller.Description = input.Description;
            }
            if (input.Type != -1)
            {
                controller.Type = input.Type;
            }
            if (input.UserGroupId != -1)
            {
                controller.UserGroupId = input.UserGroupId;
            }
            if (input.Password != null)
            {
                controller.Password = input.Password;
            }
            if (input.Adress != null)
            {
                controller.Adress = input.Adress;
            }
            return(controller);
        }
示例#2
0
        static void Main(string[] args)
        {
            SmartController controller = new SmartController();

            controller.Start();
            Console.WriteLine("The program has finished working!");
            Console.ReadKey();
        }
示例#3
0
        public void InitObject()
        {
            m_cg1         = new Category("SoftWare Engineering", "TDD");
            m_cg2         = new Category("SoftWare Engineering", "Design Patterns");
            m_cgContainer = new CategoryContainer();
            m_cgContainer.Add(m_cg1);
            m_cgContainer.Add(m_cg2);

            m_control = new SmartController();
        }
示例#4
0
        public void SinglePLayerControllerFactoryTest()
        {
            StaticServiceLocator.AddService <IControllerSettings>(new ControllerSettings());
            var controller = new SinglePlayerControllerFactory();

            controller.CreateEntityController(new BaseMovable(), new EightWayPossibleMovement(new CrowDistance()),
                                              new MoverManager());
            const Buttons buttons = Buttons.A;

            controller.AddGamePadButton(new List <IButtonAble>(), buttons);
            controller.AddKeyBoardButton(new List <IButtonAble>(), Keys.A);

            var button = new KeyButton(Keys.A);


            var smart = new SmartController();

            smart.AddButton(new BaseSmartButton(button));
            smart.Update(new GameTime());
        }
示例#5
0
        protected MenuScreen(ViewportAdapter viewPort, IServiceProvider serviceProvider)
        {
            _camera = new Camera2D(viewPort)
            {
                Zoom = 1.0f
            };
            _serviceProvider = serviceProvider;
            MenuItems        = new List <MenuItem>();

            _clickController = new ClickController();
            _clickController.MouseControl.OnPressedEvent += (state, mouseState) =>
            {
                CheckClick(mouseState.Position.ToVector2());
            };
            var moveGesture = new SmartGesture(GestureType.Tap);

            moveGesture.GestureEvent += gesture =>
            {
                CheckClick(gesture.Position);
            };
            _clickController.TouchScreenControl.AddSmartGesture(moveGesture);
            var upButtons = new List <IButtonAble>
            {
                new DirectionGamePadButton(Buttons.DPadUp),
                new KeyButton(Keys.W),
                new KeyButton(Keys.Up)
            };
            var downButtons = new List <IButtonAble>
            {
                new DirectionGamePadButton(Buttons.DPadDown),
                new KeyButton(Keys.S),
                new KeyButton(Keys.Down)
            };
            var actionButtons = new List <IButtonAble>
            {
                new GamePadButton(Buttons.A),
                new KeyButton(Keys.E)
            };
            var upAction = new CompositeSmartButton(upButtons)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    Selected--;
                }
            };
            var downAction = new CompositeSmartButton(downButtons)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    Selected++;
                }
            };
            var action = new CompositeSmartButton(actionButtons)
            {
                OnButtonReleased = (sender, args) =>
                {
                    MenuItems[Selected].Action.Invoke();
                }
            };

            _controller = new SmartController();
            _controller.AddButton(upAction);
            _controller.AddButton(downAction);
            _controller.AddButton(action);
        }
示例#6
0
        public void AddInteractionController()
        {
            var controller     = new SmartController();
            var buttonsCreated = StaticServiceLocator.ContainsService <List <IButtonAble> >();

            if (!buttonsCreated)
            {
                var interactButton = new List <IButtonAble>
                {
                    new KeyButton(Keys.E),
                    new GamePadButton(Buttons.A)
                };
                StaticServiceLocator.AddService(interactButton);
            }
            var buttons     = StaticServiceLocator.GetService <List <IButtonAble> >();
            var smartButton = new CompositeSmartButton(buttons)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    if (!DialogBox.Interact())
                    {
                        InteractEvent?.Invoke(this, null);
                    }
                }
            };

            controller.AddButton(smartButton);
            var upButton = new List <IButtonAble> {
                new DirectionGamePadButton(Buttons.DPadUp, PlayerIndex.One, false)
            };
            var smartUpButton = new CompositeSmartButton(upButton)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    DialogBox.Up();
                }
            };

            controller.AddButton(smartUpButton);
            var downButton = new List <IButtonAble> {
                new DirectionGamePadButton(Buttons.DPadDown, PlayerIndex.One, false)
            };
            var smartDownButton = new CompositeSmartButton(downButton)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    DialogBox.Down();
                }
            };

            controller.AddButton(smartDownButton);
            var optionsButtons = new List <IButtonAble>
            {
                new KeyButton(Keys.Escape),
                new GamePadButton(Buttons.Start)
            };
            var optionsAction = new CompositeSmartButton(optionsButtons)
            {
                OnButtonJustPressed = (sender, args) =>
                {
                    _backButtonClickEvent.Invoke(this, null);
                }
            };

            controller.AddButton(optionsAction);
            UpdateList.Add(controller);
        }
 public SmartController CreateController(SmartController input)
 {
     _dbContext.Add(input);
     return(input);
 }