OSDN Git Service

戦況の支援の表示が次の支援のない戦闘で消えないのを直す
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Sat, 1 Jun 2019 06:32:21 +0000 (15:32 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Sat, 1 Jun 2019 07:19:31 +0000 (16:19 +0900)
KancolleSniffer.Test/BattleTest.cs
KancolleSniffer/Model/BattleInfo.cs
KancolleSniffer/View/BattleResultPanel.cs

index fd0fa93..c1ef2c9 100644 (file)
@@ -177,7 +177,7 @@ namespace KancolleSniffer.Test
             var sniffer = new Sniffer();\r
             SniffLogFile(sniffer, "sp_midnight_002");\r
             PAssert.That(() => !sniffer.IsBattleResultError);\r
-            PAssert.That(() => sniffer.Battle.SupportType == "砲支援");\r
+            PAssert.That(() => sniffer.Battle.SupportType == 2);\r
         }\r
 \r
         /// <summary>\r
index ccb7e34..4399da2 100644 (file)
@@ -72,7 +72,7 @@ namespace KancolleSniffer.Model
         public BattleResult Result { get; set; }\r
         public bool EnemyIsCombined => _enemyGuard.Length > 0;\r
         public List<AirBattleResult> AirBattleResults { get; } = new List<AirBattleResult>();\r
-        public string SupportType { get; private set; }\r
+        public int SupportType { get; private set; }\r
 \r
         public class RankPair\r
         {\r
@@ -224,26 +224,8 @@ namespace KancolleSniffer.Model
 \r
         private void SetSupportType(dynamic json)\r
         {\r
-            var support = json.api_support_flag() ? (int)json.api_support_flag :\r
-                json.api_n_support_flag() ? (int)json.api_n_support_flag : -1;\r
-            switch (support)\r
-            {\r
-                case -1:\r
-                    SupportType = "";\r
-                    break;\r
-                case 1:\r
-                    SupportType = "空支援";\r
-                    break;\r
-                case 2:\r
-                    SupportType = "砲支援";\r
-                    break;\r
-                case 3:\r
-                    SupportType = "雷支援";\r
-                    break;\r
-                case 4:\r
-                    SupportType = "潜支援";\r
-                    break;\r
-            }\r
+            SupportType = json.api_support_flag() ? (int)json.api_support_flag :\r
+                json.api_n_support_flag() ? (int)json.api_n_support_flag : 0;\r
         }\r
 \r
         private int[] CalcFighterPower()\r
index 38b26da..b510c8c 100644 (file)
@@ -43,7 +43,7 @@ namespace KancolleSniffer.View
             public int[] FighterPower;\r
             public EnemyFighterPower EnemyFighterPower;\r
             public int AirControlLevel;\r
-            public string SupportType;\r
+            public int SupportType;\r
             public bool HaveDay => _day != null;\r
             public bool HaveNight => _night != null;\r
 \r
@@ -222,7 +222,7 @@ namespace KancolleSniffer.View
             ShowDamage(result.Damage);\r
             ShowResultRank(result.Rank);\r
             _information.Show(_data);\r
-            _supportLabel.Text = _data.SupportType;\r
+            ShowSupportType(_data.SupportType);\r
             UpdateCellInfo(_cellInfo);\r
             AutoScrollPosition = new Point(-_scrollPosition.X, -_scrollPosition.Y);\r
         }\r
@@ -300,6 +300,11 @@ namespace KancolleSniffer.View
             _rankLabel.Text = result[(int)rank];\r
         }\r
 \r
+        private void ShowSupportType(int support)\r
+        {\r
+            _supportLabel.Text = new[] {"", "空支援", "砲支援", "雷支援", "潜支援"}[support];\r
+        }\r
+\r
         public void UpdateCellInfo(CellInfo cellInfo)\r
         {\r
             _cellLabel.Text = (Spoilers & Spoiler.NextCell) == 0 ? cellInfo.Current : cellInfo.Next;\r