OSDN Git Service

戦況で支援が来るのをわかるようにする
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Mon, 14 Jan 2019 08:42:17 +0000 (17:42 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Mon, 14 Jan 2019 08:43:28 +0000 (17:43 +0900)
KancolleSniffer/Model/BattleInfo.cs
KancolleSniffer/View/BattleResultPanel.cs

index 5f20f6e..10db71c 100644 (file)
@@ -72,6 +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 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
 \r
         public class RankPair\r
         {\r
 \r
         public class RankPair\r
         {\r
@@ -104,6 +105,7 @@ namespace KancolleSniffer.Model
                 Formation = ((dynamic[])json.api_formation).Select(f => f is string ? (int)int.Parse(f) : (int)f)\r
                     .ToArray();\r
             AirControlLevel = CheckAirControlLevel(json);\r
                 Formation = ((dynamic[])json.api_formation).Select(f => f is string ? (int)int.Parse(f) : (int)f)\r
                     .ToArray();\r
             AirControlLevel = CheckAirControlLevel(json);\r
+            SetSupportType(json);\r
             ShowResult(false); // 昼戦の結果を夜戦のときに表示する\r
             SetupResult(request, json, url.Contains("practice"));\r
             FighterPower = CalcFighterPower();\r
             ShowResult(false); // 昼戦の結果を夜戦のときに表示する\r
             SetupResult(request, json, url.Contains("practice"));\r
             FighterPower = CalcFighterPower();\r
@@ -220,6 +222,28 @@ namespace KancolleSniffer.Model
             return (int)stage1.api_disp_seiku;\r
         }\r
 \r
             return (int)stage1.api_disp_seiku;\r
         }\r
 \r
+        private void SetSupportType(dynamic json)\r
+        {\r
+            SupportType = "";\r
+            if (!json.api_support_flag())\r
+                return;\r
+            switch ((int)json.api_support_flag)\r
+            {\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
+        }\r
+\r
         private int[] CalcFighterPower()\r
         {\r
             var fleets = _shipInfo.Fleets;\r
         private int[] CalcFighterPower()\r
         {\r
             var fleets = _shipInfo.Fleets;\r
index cdba9c4..9b15679 100644 (file)
@@ -31,10 +31,11 @@ namespace KancolleSniffer.View
         private readonly List<Panel> _panelList = new List<Panel>();\r
         private readonly List<ShipLabel> _hpLabels = new List<ShipLabel>();\r
         private readonly BattleInfo.BattleResult[] _result = new BattleInfo.BattleResult[2];\r
         private readonly List<Panel> _panelList = new List<Panel>();\r
         private readonly List<ShipLabel> _hpLabels = new List<ShipLabel>();\r
         private readonly BattleInfo.BattleResult[] _result = new BattleInfo.BattleResult[2];\r
-        private Label _phaseLabel, _rankLabel, _cellLabel;\r
+        private Label _phaseLabel, _rankLabel, _supportLabel, _cellLabel;\r
         private readonly BattleResultRank[] _rank = new BattleResultRank[2];\r
         private readonly InformationPanel _informationPanel;\r
         private CellInfo _cellInfo;\r
         private readonly BattleResultRank[] _rank = new BattleResultRank[2];\r
         private readonly InformationPanel _informationPanel;\r
         private CellInfo _cellInfo;\r
+        private string _supportType;\r
 \r
         public Spoiler Spoilers { get; set; }\r
 \r
 \r
         public Spoiler Spoilers { get; set; }\r
 \r
@@ -81,6 +82,7 @@ namespace KancolleSniffer.View
                 case BattleState.Unknown:\r
                     return;\r
             }\r
                 case BattleState.Unknown:\r
                     return;\r
             }\r
+            _supportType = sniffer.Battle.SupportType;\r
             if ((Spoilers & Spoiler.BattleResult) != 0)\r
             {\r
                 ShowResult(sniffer.Battle.Result);\r
             if ((Spoilers & Spoiler.BattleResult) != 0)\r
             {\r
                 ShowResult(sniffer.Battle.Result);\r
@@ -182,6 +184,7 @@ namespace KancolleSniffer.View
                 panel.Visible = false;\r
             _informationPanel.Visible = false;\r
             _rankLabel.Text = "";\r
                 panel.Visible = false;\r
             _informationPanel.Visible = false;\r
             _rankLabel.Text = "";\r
+            _supportLabel.Text = "";\r
         }\r
 \r
         private void ShowResult(BattleInfo.BattleResult result)\r
         }\r
 \r
         private void ShowResult(BattleInfo.BattleResult result)\r
@@ -292,6 +295,7 @@ namespace KancolleSniffer.View
         {\r
             var result = new[] {"完全S", "勝利S", "勝利A", "勝利B", "敗北C", "敗北D", "敗北E"};\r
             _rankLabel.Text = result[(int)rank];\r
         {\r
             var result = new[] {"完全S", "勝利S", "勝利A", "勝利B", "敗北C", "敗北D", "敗北E"};\r
             _rankLabel.Text = result[(int)rank];\r
+            _supportLabel.Text = _supportType;\r
         }\r
 \r
         public void UpdateCellInfo(CellInfo cellInfo)\r
         }\r
 \r
         public void UpdateCellInfo(CellInfo cellInfo)\r
@@ -315,6 +319,12 @@ namespace KancolleSniffer.View
                 Size = new Size(42, 12)\r
             };\r
             Controls.Add(_rankLabel);\r
                 Size = new Size(42, 12)\r
             };\r
             Controls.Add(_rankLabel);\r
+            _supportLabel = new Label\r
+            {\r
+                Location = new Point(77, 4),\r
+                AutoSize = true\r
+            };\r
+            Controls.Add(_supportLabel);\r
             _cellLabel = new Label\r
             {\r
                 Location = new Point(0, 4),\r
             _cellLabel = new Label\r
             {\r
                 Location = new Point(0, 4),\r