Пример #1
0
        public void EntityController_Update_WithOnlyLinkedEntityFieldsAltered_Succeeds()
        {
            var controllerMock = new ApiConnectionEntityControllerMock();
            var connector      = new ApiConnectorMock();
            var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

            var invoice = new SalesInvoice {
                Description = "New Description"
            };
            var line = new SalesInvoiceLine {
                Description = "InvoiceLine"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            var controller = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var ec         = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

            Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

            // Change State
            line.Description = "InvoiceLine2";
            ec.Update(invoice);

            string       result   = controllerMock.Data;
            const string expected = "{\"SalesInvoiceLines\":[{\"Description\":\"InvoiceLine2\"}]}";

            Assert.AreEqual(expected, result);
        }
Пример #2
0
 /// <summary>
 /// Adds the elements of another ControllerContainer to the end of this ControllerContainer.
 /// </summary>
 /// <param name="items">
 /// The ControllerContainer whose elements are to be added to the end of this ControllerContainer.
 /// </param>
 public virtual void AddRange(ControllerList items)
 {
     foreach (IController item in items)
     {
         Add(item);
     }
 }
Пример #3
0
        public void EntityController_Update_WithNewLinkedEntity_Succeeds()
        {
            var controllerMock   = new ApiConnectionEntityControllerMock();
            var apiConnectorMock = new ApiConnectorMock();
            var controllerList   = new ControllerList(apiConnectorMock, "https://start.exactonline.nl/api/v1/");

            var controller = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var invoice    = new SalesInvoice {
                Description = "New Description"
            };
            var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

            // Change State
            invoice.Description = "Description2";
            var line = new SalesInvoiceLine {
                Description = "InvoiceLine2"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            entityController.Update(invoice);

            string data = controllerMock.Data;

            Assert.IsTrue(data.Contains(@"""Description"":""Description2"""));
            Assert.IsTrue(data.Contains(@"""Description"":""InvoiceLine2"""));
        }
Пример #4
0
        private void ConstructPhysicsSimulator(Vector2 gravity)
        {
            geomList       = new GeomList();
            geomAddList    = new List <Geom>();
            geomRemoveList = new List <Geom>();

            bodyList       = new BodyList();
            bodyAddList    = new List <Body>();
            bodyRemoveList = new List <Body>();

            controllerList       = new ControllerList();
            controllerAddList    = new List <Controller>();
            controllerRemoveList = new List <Controller>();

            jointList       = new JointList();
            jointAddList    = new List <Joint>();
            jointRemoveList = new List <Joint>();

            _broadPhaseCollider = new SelectiveSweepCollider(this);

            arbiterList = new ArbiterList();
            _gravity    = gravity;

            arbiterPool = new Pool <Arbiter>(_arbiterPoolSize);

            #region Added by Daniel Pramel 08/17/08

            _inactivityController = new InactivityController(this);

            _scaling = new Scaling(0.001f, 0.01f);

            #endregion
        }
Пример #5
0
        public void EntityController_Update_WithExistingLinkedEntity_Succeeds()
        {
            var controllerMock = new ApiConnectionEntityControllerMock();
            var connector      = new ApiConnectorMock();
            var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

            var invoice = new SalesInvoice {
                Description = "New Description"
            };
            var line = new SalesInvoiceLine {
                Description = "InvoiceLine"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            var controller       = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

            Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

            // Change State
            invoice.Description = "Description2";
            line.Description    = "InvoiceLine2";

            entityController.Update(invoice);
            string data = controllerMock.Data;

            Assert.AreEqual(@"{""Description"":""Description2"",""SalesInvoiceLines"":[{""Description"":""InvoiceLine2""}]}", data);
        }
Пример #6
0
        /// <summary>
        /// Processes the disposed controllers, joints, springs, bodies and cleans up the arbiter list.
        /// </summary>
        private void ProcessDisposedItems()
        {
            //Allow each controller to validate itself. this is where a controller can Dispose of itself if need be.
            for (int i = 0; i < ControllerList.Count; i++)
            {
                ControllerList[i].Validate();
            }

            //Allow each joint to validate itself. this is where a joint can Dispose of itself if need be.
            for (int i = 0; i < JointList.Count; i++)
            {
                JointList[i].Validate();
            }

            //Allow each spring to validate itself. this is where a spring can Dispose of itself if need be.
            for (int i = 0; i < SpringList.Count; i++)
            {
                SpringList[i].Validate();
            }

            _tempCount = GeomList.RemoveDisposed();

            if (_tempCount > 0)
            {
                _broadPhaseCollider.ProcessDisposedGeoms();
            }

            BodyList.RemoveDisposed();
            ControllerList.RemoveDisposed();
            SpringList.RemoveDisposed();
            JointList.RemoveDisposed();

            //Clean up the arbiterlist
            ArbiterList.CleanArbiterList(arbiterPool);
        }
Пример #7
0
        public void EntityController_Update_WithNoFieldsAltered_Succeeds()
        {
            var controllerMock = new ApiConnectionEntityControllerMock();
            var connector      = new ApiConnectorMock();
            var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

            var invoice = new SalesInvoice {
                Description = "New Description"
            };
            var line = new SalesInvoiceLine {
                Description = "Invoice Line"
            };

            invoice.SalesInvoiceLines = new List <SalesInvoiceLine> {
                line
            };

            var controller       = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
            var returnValue      = controller.AddEntityToManagedEntitiesCollection(invoice);

            Assert.IsTrue(returnValue);

            entityController.Update(invoice);
            string data = controllerMock.Data;

            Assert.AreEqual("", data);
        }
Пример #8
0
 public ParameterAddress(ControllerList controllers, String address)
 {
     this.controllers = controllers;
     Name             = "Address";
     Value            = address;
     EditAddrCmd      = new RelayCommand(ex => EditAddrCmdExec(), cex => EditAddrCmdCanExec());
 }
Пример #9
0
        public UIController(InputModel inputModel, PointModel pointModel,
                            EnemyPool enemyPool, PauseModel pauseModel)
        {
            _controllers = new ControllerList();

            _pause = inputModel.Pause();
            _pause.OnKeyPressed += OnPauseKeyPressed;

            _pointModel = pointModel;
            _pointModel.OnPointsChanged += OnPointsChanged;

            _enemyPool = enemyPool;
            _enemyPool.OnEnemyKilledAndReturned += OnEnemyKilled;

            _lastEnemyKilledPanelController = new LastEnemyKilledPanelController();
            _scorePanelController           = new ScorePanelController();
            _pausePanelController           = new PausePanelController(pauseModel);
            _nullPanelController            = new NullPanelController();

            _controllers.Add(_pausePanelController);

            _scorePanelController.SetText("0");
            _pausePanelController.Close();
            _pausePanelController.OnResumeButtonPressed += ChangePanelController;

            _currentPanelController = _nullPanelController;

            _controllers.Initialize();
        }
Пример #10
0
        /// <summary>
        /// Returns null if not exist
        /// </summary>
        /// <param name="modelType"></param>
        /// <returns></returns>
        public virtual IController FindController(Type modelType)
        {
            if (m_ControllerList == null)
            {
                m_ControllerList = new ControllerList();
            }

            return(m_ControllerList.GetByType(modelType));
        }
Пример #11
0
        public virtual void AddController(IController model)
        {
            if (m_ControllerList == null)
            {
                m_ControllerList = new ControllerList();
            }

            m_ControllerList.Add(model);
        }
Пример #12
0
        public void AddController(Controller controller)
        {
            Debug.Assert(!ControllerList.Contains(controller), "You are adding the same controller more than once.");

            controller.World = this;
            ControllerList.Add(controller);

            ControllerAdded?.Invoke(controller);
        }
Пример #13
0
    public void Init(int[] elements)
    {
        foreach (int x in elements)
        {
            ControllerList cl = new ControllerList();
            cl.maxElements    = x;
            cl.currentElement = 0;

            subMenu.Add(cl);
        }
    }
Пример #14
0
        public virtual void AddController(IController model)
        {
            Type type = model.GetType();

            if (m_ControllerList == null)
            {
                m_ControllerList = new ControllerList();
            }

            m_ControllerList.Add(model);
        }
Пример #15
0
 public MoveableObject(string id,
                       ActorType actorType,
                       StatusType statusType,
                       Transform3D transform,
                       EffectParameters effectParameters,
                       Model model,
                       IController controller) :
     base(id, actorType, statusType, transform, effectParameters, model)
 {
     ControllerList.Add(controller);
 }
Пример #16
0
        public void RemoveController(Controller controller)
        {
            Debug.Assert(ControllerList.Contains(controller),
                         "You are removing a controller that is not in the simulation.");

            if (ControllerList.Contains(controller))
            {
                ControllerList.Remove(controller);

                ControllerRemoved?.Invoke(controller);
            }
        }
Пример #17
0
 /// <summary>
 /// Creates a new profile with the given name.
 /// </summary>
 /// <param name="profileName">The name of the profile.</param>
 public MadCatzProfile(string profileName)
     : base()
 {
     name        = profileName;
     version     = CURRENT_VERSION;
     controllers = new ControllerList();
     Controller[] deviceGroups = Controller.CreateAllControllers();
     foreach (Controller deviceGroup in deviceGroups)
     {
         controllers.Add(deviceGroup);
     }
     commands = new CommandList();
     blasts   = new BlastList();
 }
Пример #18
0
        //
        // GET: /Actions/

        public ActionResult Index()
        {
            /*
             * var gen_controller_action = db.GEN_CONTROLLER_ACTION;
             * return View(gen_controller_action.ToList());
             */

            ControllerList list = new ControllerList();

            //ViewBag.ControllerList = list.GetControllerActions();
            //List<ClsController> clslist = list.GetControllerActions();

            List <GEN_CONTROLLER_ACTION> db_action_list = db.GEN_CONTROLLER_ACTION.OrderBy(a => a.ACTION_NAME).OrderBy(a => a.CONTROLLER_NAME).ToList();

            List <ControllerActionViewModel> action_list = list.GetControllerActions().OrderBy(a => a.actionName).OrderBy(a => a.controllerName).ToList();

            foreach (var code_item in action_list)
            {
                foreach (var db_item in db_action_list)
                {
                    if ((code_item.controllerName.Trim() == db_item.CONTROLLER_NAME.Trim()) &&
                        (code_item.actionName.Trim() == db_item.ACTION_NAME.Trim()))
                    {
                        code_item.IsActive      = db_item.IS_ACTIVE.Value == 1 ? true : false;
                        code_item.IsAutoInclude = db_item.IS_AUTO_INCLUDE.Value == 1 ? true : false;
                        if (db_item.IS_PUBLIC.HasValue)
                        {
                            code_item.IsPublic = db_item.IS_PUBLIC.Value == 1 ? true : false;
                        }
                        else
                        {
                            code_item.IsPublic = false;
                        }

                        if (db_item.IS_MENU.HasValue)
                        {
                            code_item.IsMenu = db_item.IS_MENU.Value == 1 ? true : false;
                        }
                        else
                        {
                            code_item.IsMenu = false;
                        }

                        code_item.menuName = db_item.MENU_NAME;
                    }
                }
            }

            return(View(action_list));
        }
        /// <summary>
        /// Create instance of ExactClient
        /// </summary>
        /// <param name="exactOnlineUrl">The Exact Online URL for your country</param>
        /// <param name="division">Division number</param>
        /// <param name="accesstokenDelegate">Delegate that will be executed the access token is expired</param>
        public ExactOnlineClient(string exactOnlineUrl, int division, AccessTokenManagerDelegate accesstokenDelegate)
		{
			// Set culture for correct deserializing of API Response (comma and points)
			_apiConnector = new ApiConnector(accesstokenDelegate, this);
			//Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

			if (!exactOnlineUrl.EndsWith("/")) exactOnlineUrl += "/";
			_exactOnlineApiUrl = exactOnlineUrl + "api/v1/";

			_division = (division > 0) ? division : GetDivision();
			string serviceRoot = _exactOnlineApiUrl + _division + "/";

			_controllers = new ControllerList(_apiConnector, serviceRoot);
		}
Пример #20
0
        public void Controller_Test_ManagedEntities_WithLinkedEntities_Succeeds()
        {
            // Test if controller registrates linked entities
            IApiConnector conn           = new ApiConnectorControllerMock();
            var           controllerList = new ControllerList(conn, string.Empty);

            var salesinvoicecontroller = (Controller <SalesInvoice>)controllerList.GetController <SalesInvoice>();
            var invoicelines           = (Controller <SalesInvoiceLine>)controllerList.GetController <SalesInvoiceLine>();

            salesinvoicecontroller.GetManagerForEntity = controllerList.GetEntityManager;

            // Verify if sales invoice lines are registrated entities
            var invoice           = salesinvoicecontroller.Get("")[0];
            SalesInvoiceLine line = ((List <SalesInvoiceLine>)invoice.SalesInvoiceLines)[0];

            Assert.IsTrue(invoicelines.IsManagedEntity(line), "SalesInvoiceLine isn't a managed entity");
        }
Пример #21
0
        /// <summary>
        /// Creates a new profile from a node.
        /// </summary>
        /// <param name="validator">The validator to use for validation.</param>
        /// <param name="node">The node.</param>
        internal MadCatzProfile(NodeValidator validator, Node node)
            : base(validator, node)
        {
            name = node.Tag;
            if (node.Attributes.ContainsKey(VERSION_ATTRIBUTE))
            {
                version = ConversionHelper.ParseHexValue(node.Attributes[VERSION_ATTRIBUTE]);
                if (!SUPPORTED_VERSIONS.Contains(version))
                {
                    validator.Report.AddError("Unsupported version: " + version);
                }
            }

            foreach (var child in node.Children)
            {
                switch (child.Name.ToUpperInvariant())
                {
                case CONTROLLERS_CHILD_NODE:
                    controllers = new ControllerList(validator, child);
                    break;

                case COMMANDS_CHILD_NODE:
                    commands = new CommandList(validator, child);
                    break;

                case BLASTS_CHILD_NODE:
                    blasts = new BlastList(validator, child);
                    break;
                }
            }

            if (controllers == null)
            {
                controllers = new ControllerList();
            }
            if (commands == null)
            {
                commands = new CommandList();
            }
            if (blasts == null)
            {
                blasts = new BlastList();
            }
        }
Пример #22
0
        public ActionResult Index(ControllerActionViewModel[] controllers)
        {
            foreach (var cont in controllers)
            {
                GEN_CONTROLLER_ACTION record = db.GEN_CONTROLLER_ACTION.
                                               Where(a => a.ACTION_NAME == cont.actionName && a.CONTROLLER_NAME == cont.controllerName).
                                               FirstOrDefault();
                if (record == null)
                {
                    GEN_CONTROLLER_ACTION conac = new GEN_CONTROLLER_ACTION();

                    conac.ACTION_NAME     = cont.actionName;
                    conac.CONTROLLER_NAME = cont.controllerName;
                    conac.IS_AUTO_INCLUDE = cont.IsAutoInclude == true ? 1 : 0;
                    conac.IS_ACTIVE       = cont.IsActive == true ? 1 : 0;
                    conac.IS_PUBLIC       = cont.IsPublic == true ? 1 : 0;
                    conac.IS_MENU         = cont.IsMenu == true ? 1 : 0;
                    conac.MENU_NAME       = cont.menuName;

                    db.GEN_CONTROLLER_ACTION_INSERT(conac.CONTROLLER_NAME, conac.ACTION_NAME, conac.IS_ACTIVE,
                                                    conac.IS_PUBLIC, conac.IS_AUTO_INCLUDE, conac.PARENT_ACTION_NO, conac.IS_MENU,
                                                    conac.MENU_NAME, conac.PARENT_MENU_NO, conac.IS_SUB_MENU, conac.DETAILS, conac.SL_NUM);
                }
                else
                {
                    record.IS_AUTO_INCLUDE = cont.IsAutoInclude == true ? 1 : 0;
                    record.IS_ACTIVE       = cont.IsActive == true ? 1 : 0;
                    record.IS_PUBLIC       = cont.IsPublic == true ? 1 : 0;
                    record.IS_MENU         = cont.IsMenu == true ? 1 : 0;
                    record.MENU_NAME       = cont.menuName;

                    db.GEN_CONTROLLER_ACTION_UPDATE(record.ACTION_NO, record.CONTROLLER_NAME, record.ACTION_NAME,
                                                    record.IS_ACTIVE, record.IS_PUBLIC, record.IS_AUTO_INCLUDE, record.PARENT_ACTION_NO,
                                                    record.IS_MENU, record.MENU_NAME, record.PARENT_MENU_NO, record.IS_SUB_MENU,
                                                    record.DETAILS, record.SL_NUM);
                }
            }
            //db.SaveChanges();

            ControllerList list = new ControllerList();
            List <ControllerActionViewModel> clist = list.GetControllerActions().OrderBy(a => a.actionName).OrderBy(a => a.controllerName).ToList();

            return(View(clist));
        }
		public async Task EntityController_Update_WithNoFieldsAltered_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var connector = new ApiConnectorMock();
			var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

			var invoice = new SalesInvoice {Description = "New Description"};
			var line = new SalesInvoiceLine {Description = "Invoice Line"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line }; 

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
			var returnValue = controller.AddEntityToManagedEntitiesCollection(invoice);

			Assert.IsTrue(returnValue);

			await entityController.UpdateAsync(invoice);
			string data = controllerMock.Data;
			Assert.AreEqual("", data);
		}
		public async Task EntityController_Update_WithNewLinkedEntity_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var apiConnectorMock = new ApiConnectorMock();
			var controllerList = new ControllerList(apiConnectorMock, "https://start.exactonline.nl/api/v1/");

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var invoice = new SalesInvoice {Description = "New Description"};
			var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

			// Change State
			invoice.Description = "Description2";
			var line = new SalesInvoiceLine {Description = "InvoiceLine2"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line }; 

			await entityController.UpdateAsync(invoice);

			string data = controllerMock.Data;
			Assert.IsTrue(data.Contains(@"""Description"":""Description2"""));
			Assert.IsTrue(data.Contains(@"""Description"":""InvoiceLine2"""));
		}
		public async Task EntityController_Update_WithExistingLinkedEntity_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var connector = new ApiConnectorMock();
			var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

			var invoice = new SalesInvoice {Description = "New Description"};
			var line = new SalesInvoiceLine {Description = "InvoiceLine"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line };

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
			Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

			// Change State
			invoice.Description = "Description2";
			line.Description = "InvoiceLine2";

			await entityController.UpdateAsync(invoice);
			string data = controllerMock.Data;
			Assert.AreEqual(@"{""Description"":""Description2"",""SalesInvoiceLines"":[{""Description"":""InvoiceLine2""}]}", data);
		}
Пример #26
0
 public Enumerator(ControllerList collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
Пример #27
0
 /// <summary>
 /// Initializes a new instance of the ControllerContainer class, containing elements
 /// copied from another instance of ControllerContainer
 /// </summary>
 /// <param name="items">
 /// The ControllerContainer whose elements are to be added to the new ControllerContainer.
 /// </param>
 public ControllerList(ControllerList items)
 {
     this.AddRange(items);
 }
Пример #28
0
        //Body, wait for engine updates
        #endregion

        #region Constructors
        public MoveableObject(ModelObject modelObject, IController controller) :
            base(modelObject)
        {
            ControllerList.Add(controller);
        }
Пример #29
0
        /// <summary>
        /// Processes the added geometries, springs, joints, bodies and controllers.
        /// </summary>
        private void ProcessAddedItems()
        {
            //Add any new geometries
            _tempCount = _geomAddList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                if (!GeomList.Contains(_geomAddList[i]))
                {
                    _geomAddList[i].InSimulation = true;
                    GeomList.Add(_geomAddList[i]);

                    //Add the new geometry to the broad phase collider.
                    _broadPhaseCollider.Add(_geomAddList[i]);
                }
            }
            _geomAddList.Clear();

            //Add any new bodies
            _tempCount = _bodyAddList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                if (!BodyList.Contains(_bodyAddList[i]))
                {
                    BodyList.Add(_bodyAddList[i]);
                }
            }
            _bodyAddList.Clear();

            //Add any new controllers
            _tempCount = _controllerAddList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                if (!ControllerList.Contains(_controllerAddList[i]))
                {
                    ControllerList.Add(_controllerAddList[i]);
                }
            }
            _controllerAddList.Clear();

            //Add any new joints
            _tempCount = _jointAddList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                if (!JointList.Contains(_jointAddList[i]))
                {
                    JointList.Add(_jointAddList[i]);
                }
            }
            _jointAddList.Clear();

            //Add any new springs
            _tempCount = _springAddList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                if (!SpringList.Contains(_springAddList[i]))
                {
                    SpringList.Add(_springAddList[i]);
                }
            }
            _springAddList.Clear();
        }
Пример #30
0
 public SecondaryWindowController(IBaseWindow view) : base(view)
 {
     Console.WriteLine("SecondaryWindowController");
     ControllerList.ForEach(Console.WriteLine);
 }
Пример #31
0
 public MainWindowController(IBaseWindow view) : base(view)
 {
     Console.WriteLine("MainWindowController");
     ControllerList.ForEach(Console.WriteLine);
 }
Пример #32
0
        /// <summary>
        /// Processes the removed geometries (and their arbiters), bodies, controllers, joints and springs.
        /// </summary>
        private void ProcessRemovedItems()
        {
            //Remove any new geometries
            _tempCount = _geomRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                _geomRemoveList[i].InSimulation = false;
                GeomList.Remove(_geomRemoveList[i]);

                //Remove any arbiters associated with the geometries being removed
                for (int j = ArbiterList.Count; j > 0; j--)
                {
                    if (ArbiterList[j - 1].GeometryA == _geomRemoveList[i] ||
                        ArbiterList[j - 1].GeometryB == _geomRemoveList[i])
                    {
                        //TODO: Should we create a RemoveComplete method and remove all Contacts associated
                        //with the arbiter?
                        arbiterPool.Insert(ArbiterList[j - 1]);
                        ArbiterList.Remove(ArbiterList[j - 1]);
                    }
                }
            }

            if (_geomRemoveList.Count > 0)
            {
                _broadPhaseCollider.ProcessRemovedGeoms();
            }

            _geomRemoveList.Clear();

            //Remove any new bodies
            _tempCount = _bodyRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                BodyList.Remove(_bodyRemoveList[i]);
            }
            _bodyRemoveList.Clear();

            //Remove any new controllers
            _tempCount = _controllerRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                ControllerList.Remove(_controllerRemoveList[i]);
            }
            _controllerRemoveList.Clear();

            //Remove any new joints
            int jointRemoveCount = _jointRemoveList.Count;

            for (int i = 0; i < jointRemoveCount; i++)
            {
                JointList.Remove(_jointRemoveList[i]);
            }
            _jointRemoveList.Clear();

            //Remove any new springs
            _tempCount = _springRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                SpringList.Remove(_springRemoveList[i]);
            }
            _springRemoveList.Clear();
        }
Пример #33
0
        private void ConstructPhysicsSimulator(Vector2 gravity)
        {
            geomList = new GeomList();
            geomAddList = new List<Geom>();
            geomRemoveList = new List<Geom>();

            bodyList = new BodyList();
            bodyAddList = new List<Body>();
            bodyRemoveList = new List<Body>();

            controllerList = new ControllerList();
            controllerAddList = new List<Controller>();
            controllerRemoveList = new List<Controller>();

            jointList = new JointList();
            jointAddList = new List<Joint>();
            jointRemoveList = new List<Joint>();

            springList = new SpringList();
            springAddList = new List<Spring>();
            springRemoveList = new List<Spring>();

            _broadPhaseCollider = new SelectiveSweepCollider(this);

            arbiterList = new ArbiterList();
            _gravity = gravity;

            arbiterPool = new Pool<Arbiter>(_arbiterPoolSize);

            #region Added by Daniel Pramel 08/17/08

            _inactivityController = new InactivityController(this);

            _scaling = new Scaling(0.001f, 0.01f);

            #endregion
        }
		public async Task EntityController_Update_WithOnlyLinkedEntityFieldsAltered_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var connector = new ApiConnectorMock();
			var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

			var invoice = new SalesInvoice {Description = "New Description"};
			var line = new SalesInvoiceLine {Description = "InvoiceLine"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line };

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var ec = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
			Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

			// Change State
			line.Description = "InvoiceLine2";
			await ec.UpdateAsync(invoice);

			string result = controllerMock.Data;
			const string expected = "{\"SalesInvoiceLines\":[{\"Description\":\"InvoiceLine2\"}]}";
			Assert.AreEqual(expected, result);
		}
    private void CheckWhichControllersAreConnected()
    {
        #region ControllerCheck

        int joystickNumber = Input.GetJoystickNames().Length;//get how many axes are connected to our controller


        if (joystickNumber == 19)
        {
            myController = ControllerList.ps4;

            horizontalAxisName    = "Ps4Horizontal";
            altHorizontalAxisName = "altPs4Horizontal";
            verticalAxisName      = "Ps4Vertical";
            altVerticalAxisName   = "altPs4Vertical";
            topFaceButtonName     = "Ps4Triangle";
            bottomFaceButtonName  = "Ps4X";
            leftFaceButtonName    = "Ps4Square";
            rightFaceButtonName   = "Ps4O";
            leftBumperName        = "Ps4L1";
            rightBumperName       = "Ps4R1";
            leftTriggerName       = "Ps4L2";
            rightTriggerName      = "Ps4R2";
            startButtonName       = "Ps4Options";
            selectButtonName      = "Ps4Share";
        }
        else if (joystickNumber == 33)//check if we have an xbox controller
        {
            myController = ControllerList.xbox;

            horizontalAxisName    = "XboxHorizontal";
            altHorizontalAxisName = "altXboxHorizontal";
            verticalAxisName      = "XboxVertical";
            altVerticalAxisName   = "altXboxVertical";
            topFaceButtonName     = "XboxY";
            bottomFaceButtonName  = "XboxA";
            leftFaceButtonName    = "XboxX";
            rightFaceButtonName   = "XboxB";
            leftBumperName        = "XboxLB";
            rightBumperName       = "XboxRB";
            leftTriggerName       = "XboxLT";
            rightTriggerName      = "XboxRT";
            startButtonName       = "XboxMenu";
            selectButtonName      = "XboxBack";
        }

        else  //first check for a keyboard control
        {
            myController          = ControllerList.keyboard;
            horizontalAxisName    = "KeyboardHorizontal";
            altHorizontalAxisName = horizontalAxisName;//no alt button with keyboard
            verticalAxisName      = "KeyboardVertical";
            altVerticalAxisName   = verticalAxisName;
            topFaceButtonName     = "KeyboardV";
            bottomFaceButtonName  = "KeyboardZ";
            leftFaceButtonName    = "KeyboardX";
            rightFaceButtonName   = "KeyboardC";
            leftBumperName        = "KeyboardQ";
            rightBumperName       = "KeyboardE";
            leftTriggerName       = "KeyboardLeftShift";
            rightTriggerName      = "KeyboarLeftCtrl";
            startButtonName       = "KeyboardEscape";
            selectButtonName      = "KeyboardBackspace";
        }
    }
Пример #36
0
        public void Controller_Test_ManagedEntities_WithLinkedEntities_Succeeds()
        {
            // Test if controller registrates linked entities
            IApiConnector conn = new ApiConnectorControllerMock();
            var controllerList = new ControllerList(conn, string.Empty);

            var salesinvoicecontroller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
            var invoicelines = (Controller<SalesInvoiceLine>)controllerList.GetController<SalesInvoiceLine>();
            salesinvoicecontroller.GetManagerForEntity = controllerList.GetEntityManager;

            // Verify if sales invoice lines are registrated entities
            var invoice = salesinvoicecontroller.Get("")[0];
            SalesInvoiceLine line = ((List<SalesInvoiceLine>)invoice.SalesInvoiceLines)[0];
            Assert.IsTrue(invoicelines.IsManagedEntity(line), "SalesInvoiceLine isn't a managed entity");
        }