コード例 #1
0
        void UpdateCore()
        {
            if (r_SelectAllTypes.HasValue && !r_SelectAllTypes.Value)
                Ships = null;
            else
            {
                r_Ships = KanColleGame.Current.Port.Ships.Values.Select(r =>
                {
                    ShipViewModel rResult;
                    if (!r_ShipVMs.TryGetValue(r.ID, out rResult))
                        rResult = new ShipViewModel(r, r_TypeMap[r.Info.Type]);

                    return rResult;
                }).ToArray();

                var rShips = r_Ships.Where(r => r.Type.IsSelected)
                    .Where(r => !ExceptExpeditionShips || (r.Ship.State & ShipState.Expedition) == 0)
                    .Where(r => !ExceptSparklingShips || (r.Ship.Condition < 50))
                    .Where(r => !ExceptLevel1Ships || (r.Ship.Level > 1));
                switch (r_SortingColumn)
                {
                    case "ID":
                        rShips = rShips.OrderBy(r => r.Ship.ID);
                        break;

                    case "Name":
                        rShips = rShips.OrderBy(r => r.Ship.Info.Name);
                        break;

                    case "ShipLocking":
                        rShips = rShips.OrderByDescending(r => r.Ship.RawData.LockingTag != 0).ThenBy(r => r.Ship.RawData.LockingTag);
                        break;

                    case "Level":
                        rShips = rShips.OrderByDescending(r => r.Ship.Level).ThenBy(r => r.Ship.ExperienceToNextLevel);
                        break;

                    case "Condition":
                        rShips = rShips.OrderByDescending(r => r.Ship.Condition);
                        break;

                    case "Firepower":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.FirepowerBase.Current);
                        break;
                    case "Torpedo":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.TorpedoBase.Current);
                        break;
                    case "AA":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.AABase.Current);
                        break;
                    case "Armor":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.ArmorBase.Current);
                        break;
                    case "Luck":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.LuckBase.Current);
                        break;

                    case "Evasion":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.Evasion);
                        break;
                    case "ASW":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.ASW);
                        break;
                    case "LoS":
                        rShips = rShips.OrderByDescending(r => r.Ship.Status.LoS);
                        break;

                    case "RepairTime":
                        rShips = rShips.OrderByDescending(r => r.Ship.RepairTime);
                        break;
                }

                Ships = rShips.ToArray().AsReadOnly();
            }

            OnPropertyChanged(nameof(Ships));
            IsLoading = false;
        }
コード例 #2
0
        void UpdateCore()
        {
            if (r_SelectAllTypes.HasValue && !r_SelectAllTypes.Value)
            {
                Ships = null;
            }
            else
            {
                r_Ships = KanColleGame.Current.Port.Ships.Values.Select(r =>
                {
                    ShipViewModel rResult;
                    if (!r_ShipVMs.TryGetValue(r.ID, out rResult))
                    {
                        rResult = new ShipViewModel(r, r_TypeMap[r.Info.Type]);
                    }

                    return(rResult);
                }).ToArray();

                var rShips = r_Ships.Where(r => r.Type.IsSelected)
                             .Where(r => !ExceptExpeditionShips || (r.Ship.State & ShipState.Expedition) == 0)
                             .Where(r => !ExceptSparklingShips || (r.Ship.Condition < 50))
                             .Where(r => !ExceptLevel1Ships || (r.Ship.Level > 1));
                switch (r_SortingColumn)
                {
                case "ID":
                    rShips = rShips.OrderBy(r => r.Ship.ID);
                    break;

                case "Name":
                    rShips = rShips.OrderBy(r => r.Ship.Info.Name);
                    break;

                case "ShipLocking":
                    rShips = rShips.OrderByDescending(r => r.Ship.RawData.LockingTag != 0).ThenBy(r => r.Ship.RawData.LockingTag);
                    break;

                case "Level":
                    rShips = rShips.OrderByDescending(r => r.Ship.Level).ThenBy(r => r.Ship.ExperienceToNextLevel);
                    break;

                case "Condition":
                    rShips = rShips.OrderByDescending(r => r.Ship.Condition);
                    break;

                case "Firepower":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.FirepowerBase.Current);
                    break;

                case "Torpedo":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.TorpedoBase.Current);
                    break;

                case "AA":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.AABase.Current);
                    break;

                case "Armor":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.ArmorBase.Current);
                    break;

                case "Luck":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.LuckBase.Current);
                    break;

                case "Evasion":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.Evasion);
                    break;

                case "ASW":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.ASW);
                    break;

                case "LoS":
                    rShips = rShips.OrderByDescending(r => r.Ship.Status.LoS);
                    break;

                case "RepairTime":
                    rShips = rShips.OrderByDescending(r => r.Ship.RepairTime);
                    break;
                }

                Ships = rShips.ToArray().AsReadOnly();
            }

            OnPropertyChanged(nameof(Ships));
            IsLoading = false;
        }