RemoveAt() 공개 메소드

public RemoveAt ( int i ) : void
i int
리턴 void
        public async void ListItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            int    index                = e.SelectedItemIndex;
            Person selectedPerson       = PersonList[index];
            IndividualUserResponse resp = new IndividualUserResponse();

            resp.UserId = selectedPerson.Id;
            var result = await DisplayAlert("Confirm", $"Mark {selectedPerson.Forename} {selectedPerson.Surname} as safe?", "Yes", "No");

            if (result == true)
            {
                service.PostUserIsSafe(resp);
                PersonList.RemoveAt(index);
            }
        }
예제 #2
0
        private void PersonChanged(object obj)
        {
            Person person = (Person)obj;

            int index = PersonList.IndexOf(person);

            if (index != -1)
            {
                PersonList.RemoveAt(index);
                PersonList.Insert(index, person);
            }
            else
            {
                PersonList.Add(person);
            }
        }
예제 #3
0
        /// <summary>
        /// Event which fires on each tick of the simulationTimer, advancing the simulation by allowing people to move and determining if any new tiles need to catch on fire.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void AdvanceSimulation(Object source, System.Timers.ElapsedEventArgs e)
        {
            previousStates.Add(new SimulationState(this));
            Map.SpreadFire();
            dead = 0;

            for (int i = PersonList.Count - 1; i >= 0; i--)
            {
                Person person = PersonList.ElementAt(i);

                if (person.Health != 0)
                {
                    if (map.TilesArray[person.Location.X, person.Location.Y] is TileFloor)
                    {
                        if (((TileFloor)map.TilesArray[person.Location.X, person.Location.Y]).HasSmoke)
                        {
                            person.DecreaseHealth(Person.DamageType.Smoke);
                        }

                        if (((TileFloor)map.TilesArray[person.Location.X, person.Location.Y]).OnFire)
                        {
                            person.DecreaseHealth(Person.DamageType.Fire);
                        }
                        person.IncreasePanicLevel(map.TilesArray[person.Location.X, person.Location.Y]);
                    }
                    if (map.TilesArray[person.Location.X, person.Location.Y] is TileExit)
                    {
                        PersonList.RemoveAt(i);
                        escaped++;
                    }
                    else if (map.TilesArray[person.Location.X, person.Location.Y] is TileWindow)
                    {
                        Random rng = new Random();

                        if (rng.Next(1, 21) <= 5 * map.FloorLevel) // Survival chance of jumping out of the window. Increased by floor level.
                        {
                            person.DecreaseHealth(Person.DamageType.Falling);
                        }
                        else
                        {
                            escaped++;
                            PersonList.RemoveAt(i);
                        }

                        person.Jumped = true;
                    }
                    else
                    {
                        if (person.Health > 0)
                        {
                            person.Move();
                        }
                    }
                }
                else
                {
                    dead++;
                }
            }

            timeElapsed += (double)simulationInterval / 1000;
            RedrawPanel();
        }