OSDN Git Service

複数マップを攻略する任務のカウンターの仕様と実装を変更する
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / Model / QuestCounter.cs
index 9c66937..20cae9b 100644 (file)
@@ -77,11 +77,11 @@ namespace KancolleSniffer.Model
 \r
         public override string ToString()\r
         {\r
-            if (Id == 280 || Id == 284 || Id == 426 || Id == 845 || Id == 854 || Id == 872 || Id == 873 || Id == 888 || Id == 894)\r
-                return $"{NowArray.Count(n => n >= 1)}/{Spec.MaxArray.Length}";\r
-            return NowArray != null\r
-                ? string.Join(" ", NowArray.Zip(Spec.MaxArray, (n, m) => $"{n}/{m}"))\r
-                : $"{Now}/{Spec.Max}";\r
+            return Spec.MaxArray != null && Spec.MaxArray.All(x => x == 1)\r
+                ? string.Join("\u200a", NowArray.Select(n => (n % 10).ToString()))\r
+                : Spec.MaxArray != null\r
+                    ? string.Join(" ", NowArray.Zip(Spec.MaxArray, (n, m) => $"{n}/{m}"))\r
+                    : $"{Now}/{Spec.Max}";\r
         }\r
 \r
         public QuestCount Clone()\r
@@ -101,61 +101,38 @@ namespace KancolleSniffer.Model
             return NowArray.SequenceEqual(other.NowArray);\r
         }\r
 \r
+        private static string MapString(int map)\r
+        {\r
+            return map switch\r
+            {\r
+                721 => "7-2G",\r
+                722 => "7-2M",\r
+                _ => $"{map / 10}-{map % 10}"\r
+            };\r
+        }\r
+\r
         public string ToToolTip()\r
         {\r
-            switch (Id)\r
+            if (Spec is QuestSortie spec && spec.Maps != null)\r
             {\r
-                case 280:\r
-                    return string.Join(" ",\r
-                        new[] {"1-2", "1-3", "1-4", "2-1"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 284:\r
-                    return string.Join(" ",\r
-                        new[] {"1-4", "2-1", "2-2", "2-3"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 426:\r
-                    return string.Join(" ",\r
-                        new[] {"警備任務", "対潜警戒任務", "海上護衛任務", "強硬偵察任務"}\r
-                            .Zip(NowArray, (mission, n) => n >= 1 ? mission : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 428:\r
-                    return string.Join(" ",\r
-                        new[] {"対潜警戒任務", "海峡警備行動", "長時間対潜警戒"}.Zip(NowArray, (mission, n) => n >= 1 ? mission + n : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 845:\r
-                    return string.Join(" ",\r
-                        new[] {"4-1", "4-2", "4-3", "4-4", "4-5"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 854:\r
-                    return string.Join(" ",\r
-                        new[] {"2-4", "6-1", "6-3", "6-4"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 872:\r
-                    return string.Join(" ",\r
-                        new[] {"7-2M", "5-5", "6-2", "6-5"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 873:\r
-                    return string.Join(" ",\r
-                        new[] {"3-1", "3-2", "3-3"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 888:\r
-                    return string.Join(" ",\r
-                        new[] {"5-1", "5-3", "5-4"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 688:\r
-                    return string.Join(" ",\r
-                        new[] {"艦戦", "艦爆", "艦攻", "水偵"}.Zip(NowArray, (type, n) => n >= 1 ? type + n : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 893:\r
-                    return string.Join(" ",\r
-                        new[] {"1-5", "7-1", "7-2G", "7-2M"}.Zip(NowArray, (map, n) => n >= 1 ? $"{map}:{n}" : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
-                case 894:\r
-                    return string.Join(" ",\r
-                        new[] {"1-3", "1-4", "2-1", "2-2", "2-3"}.Zip(NowArray, (map, n) => n >= 1 ? map : "")\r
-                            .Where(s => !string.IsNullOrEmpty(s)));\r
+                var flags = spec.MaxArray.All(x => x == 1);\r
+                return string.Join(" ",\r
+                    spec.Maps.Zip(NowArray, (map, n) => n >= 1 ? $"{MapString(map)}{(flags ? "" : $":{n}")}" : "")\r
+                    .Where(s => !string.IsNullOrEmpty(s)));\r
             }\r
-            return "";\r
+            return Id switch\r
+            {\r
+                426 => string.Join(" ",\r
+                    new[] {"警備任務", "対潜警戒任務", "海上護衛任務", "強硬偵察任務"}.Zip(NowArray, (mission, n) => n >= 1 ? mission : "")\r
+                        .Where(s => !string.IsNullOrEmpty(s))),\r
+                428 => string.Join(" ",\r
+                    new[] {"対潜警戒任務", "海峡警備行動", "長時間対潜警戒"}.Zip(NowArray, (mission, n) => n >= 1 ? mission + n : "")\r
+                        .Where(s => !string.IsNullOrEmpty(s))),\r
+                688 => string.Join(" ",\r
+                    new[] {"艦戦", "艦爆", "艦攻", "水偵"}.Zip(NowArray, (type, n) => n >= 1 ? type + n : "")\r
+                        .Where(s => !string.IsNullOrEmpty(s))),\r
+                _ => ""\r
+            };\r
         }\r
 \r
         public bool Cleared => NowArray?.Zip(Spec.MaxArray, (n, m) => n >= m).All(x => x) ??\r