상속: FirstFloor.ModernUI.Presentation.Displayable, IDraggable
예제 #1
0
        public void DeleteEntry(RaceGridEntry entry)
        {
            if (entry is RaceGridPlayerEntry)
            {
                StartingPosition = 0;
                return;
            }

            NonfilteredList.Remove(entry);
            if (Mode == BuiltInGridMode.Custom)
            {
                UpdateOpponentsNumber();
            }
            else
            {
                Mode = BuiltInGridMode.CandidatesManual;
            }

            UpdateExceeded();
        }
예제 #2
0
 public bool Same(RaceGridEntry other)
 {
     return(GetType().Name == other.GetType().Name&& Car == other.Car &&
            CarSkin == other.CarSkin && Name == other.Name && Nationality == other.Nationality && AiLevel == other.AiLevel);
 }
예제 #3
0
        public void InsertEntry(int index, [NotNull] RaceGridEntry entry)
        {
            var oldIndex = NonfilteredList.IndexOf(entry);

            var count = NonfilteredList.Count;
            var isNew = oldIndex == -1;
            var limit = isNew ? count : count - 1;

            if (index < 0 || index > limit)
            {
                index = limit;
            }

            if (oldIndex == index)
            {
                return;
            }
            if (Mode.CandidatesMode)
            {
                if (isNew)
                {
                    Mode = BuiltInGridMode.CandidatesManual;

                    var existed = NonfilteredList.FirstOrDefault(x => x.Same(entry));
                    if (existed != null)
                    {
                        existed.CandidatePriority++;
                    }
                    else
                    {
                        NonfilteredList.Add(entry);
                    }

                    return;
                }

                NonfilteredList.ReplaceEverythingBy(NonfilteredList.Sort(Compare));
                NonfilteredList.Move(oldIndex, index);

                try {
                    _modeKeepOrder = true;
                    Mode           = BuiltInGridMode.Custom;
                } finally {
                    _modeKeepOrder = false;
                }
            }
            else if (isNew)
            {
                if (index == count)
                {
                    NonfilteredList.Add(entry);
                }
                else
                {
                    NonfilteredList.Insert(index, entry);
                }

                UpdateOpponentsNumber();
            }
            else if (index != oldIndex)
            {
                NonfilteredList.Move(oldIndex, index);
            }

            if (StartingPosition != 0)
            {
                StartingPositionLimited = NonfilteredList.IndexOf(_playerEntry) + 1;
            }

            UpdateExceeded();
        }
예제 #4
0
 public void AddEntry([NotNull] RaceGridEntry entry)
 {
     InsertEntry(-1, entry);
 }
예제 #5
0
 public bool Same(RaceGridEntry other) {
     return GetType().Name == other.GetType().Name && Car == other.Car &&
             CarSkin == other.CarSkin && Name == other.Name && Nationality == other.Nationality && AiLevel == other.AiLevel;
 }
예제 #6
0
        public void DeleteEntry(RaceGridEntry entry) {
            if (entry is RaceGridPlayerEntry) {
                StartingPosition = 0;
                return;
            }

            NonfilteredList.Remove(entry);
            if (Mode == BuiltInGridMode.Custom) {
                UpdateOpponentsNumber();
            } else {
                Mode = BuiltInGridMode.CandidatesManual;
            }

            UpdateExceeded();
        }