Example #1
0
        /// <summary>
        /// Updates the system location of this contact. The 4 blocks of updates to the lists will, I hope, facilitate efficient updating of the binding list.
        /// </summary>
        /// <param name="system">new System.</param>
        public void UpdateSystem(StarSystem system)
        {
            CurrentSystem = system;

            DistanceTable.Clear();
            DistanceUpdate.Clear();

            DistanceTable.RaiseListChangedEvents  = false;
            DistanceUpdate.RaiseListChangedEvents = false;

            for (int loop = 0; loop < CurrentSystem.SystemContactList.Count; loop++)
            {
                DistanceTable.Add(0.0f);
                DistanceUpdate.Add(-1);
            }

            DistanceTable.RaiseListChangedEvents  = true;
            DistanceUpdate.RaiseListChangedEvents = true;

            /// <summary>
            /// BindingLists apparently do a bunch of events every time they are changed.
            /// This has hopefully circumvented that, with just 1 event.
            /// </summary>
            DistanceTable.ResetBindings();
            DistanceUpdate.ResetBindings();
        }
Example #2
0
        /// <summary>
        /// Creates a new system contact.
        /// </summary>
        /// <param name="Fact">Faction of contact.</param>
        /// <param name="entity">Backing entity of the contact.</param>
        public SystemContact(Faction Fact, StarSystemEntity entity)
        {
            Id           = Guid.NewGuid();
            faction      = Fact;
            Position     = entity.Position;
            LastPosition = Position;

            Entity = entity;

            DistTable = new DistanceTable(this);

            SSEntity = entity.SSEntity;
        }
Example #3
0
        /// <summary>
        /// Creates a new system contact.
        /// </summary>
        /// <param name="Fact">Faction of contact.</param>
        /// <param name="entity">Backing entity of the contact.</param>
        public SystemContact(Faction Fact, StarSystemEntity entity)
        {
            Id           = Guid.NewGuid();
            faction      = Fact;
            Position     = entity.Position;
            LastPosition = Position;

            Entity = entity;

            DistTable = new DistanceTable(this);

            SSEntity = entity.SSEntity;

            //add legal orders to list
            _legalOrders.Add(Constants.ShipTN.OrderType.Follow);
        }
Example #4
0
        /// <summary>
        /// Creates a new system contact.
        /// </summary>
        /// <param name="Fact">Faction of contact.</param>
        /// <param name="entity">Backing entity of the contact.</param>
        public SystemContact(Faction Fact, StarSystemEntity entity)
        {
            Id = Guid.NewGuid();
            faction = Fact;
            Position = entity.Position;
            LastPosition = Position;

            Entity = entity;

            DistTable = new DistanceTable(this);

            SSEntity = entity.SSEntity;

            //add legal orders to list
            _legalOrders.Add(Constants.ShipTN.OrderType.Follow);
        }