--- /dev/null
+// Copyright (C) 2016 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+\r
+using System.Drawing;\r
+using System.Windows.Forms;\r
+\r
+// ReSharper disable CoVariantArrayConversion\r
+\r
+namespace KancolleSniffer\r
+{\r
+ public class AirBattleResult\r
+ {\r
+ public class StageResult\r
+ {\r
+ public int FriendCount { get; set; }\r
+ public int FriendLost { get; set; }\r
+ public int EnemyCount { get; set; }\r
+ public int EnemyLost { get; set; }\r
+ }\r
+\r
+ public StageResult Stage1 { get; set; } = new StageResult();\r
+ public StageResult Stage2 { get; set; } = new StageResult();\r
+ }\r
+\r
+ public class AirBattleResultPanel : Panel\r
+ {\r
+ private readonly Label[][][] _resultLabels = new Label[2][][];\r
+\r
+ public AirBattleResultPanel()\r
+ {\r
+ var labels = new[]\r
+ {\r
+ new Label {Text = "航空戦", Location = new Point(4, 4), AutoSize = true},\r
+ new Label {Text = "stage1", Location = new Point(4, 18), AutoSize = true},\r
+ new Label {Text = "stage2", Location = new Point(4, 32), AutoSize = true},\r
+ new Label {Text = "自軍", Location = new Point(59, 4), AutoSize = true},\r
+ new Label {Text = "敵軍", Location = new Point(115, 4), AutoSize = true}\r
+ };\r
+ Controls.AddRange(labels);\r
+ for (var stage = 0; stage < 2; stage++)\r
+ {\r
+ _resultLabels[stage] = new Label[2][];\r
+ for (var fe = 0; fe < 2; fe++)\r
+ {\r
+ _resultLabels[stage][fe] = new Label[2];\r
+ Controls.Add(_resultLabels[stage][fe][1] = new Label\r
+ {\r
+ Location = new Point(78 + 56 * fe, 18 + 14 * stage),\r
+ Size = new Size(23, 12),\r
+ TextAlign = ContentAlignment.TopLeft,\r
+ });\r
+ Controls.Add(new Label\r
+ {\r
+ Location = new Point(66 + 56 * fe, 18 + 14 * stage),\r
+ Text = "→",\r
+ AutoSize = true\r
+ });\r
+ Controls.Add(_resultLabels[stage][fe][0] = new Label\r
+ {\r
+ Location = new Point(46 + 56 * fe, 18 + 14 * stage),\r
+ Size = new Size(23, 12),\r
+ TextAlign = ContentAlignment.TopRight,\r
+ });\r
+ }\r
+ }\r
+ }\r
+\r
+ public void SetResult(AirBattleResult result)\r
+ {\r
+ var stages = new[] {result.Stage1, result.Stage2};\r
+ for (var i = 0; i < 2; i++)\r
+ {\r
+ var stage = stages[i];\r
+ var labels = _resultLabels[i];\r
+ labels[0][0].Text = $"{stage.FriendCount}";\r
+ labels[0][1].Text = $"{stage.FriendCount - stage.FriendLost}";\r
+ labels[1][0].Text = $"{stage.EnemyCount}";\r
+ labels[1][1].Text = $"{stage.EnemyCount - stage.EnemyLost}";\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file
public int AirControlLevel { get; private set; }\r
public BattleResultRank ResultRank { get; private set; }\r
public ShipStatus[] EnemyResultStatus { get; private set; }\r
+ public AirBattleResult AirBattleResults { get; private set; }\r
\r
public BattleInfo(ShipInfo shipInfo, ItemInfo itemInfo)\r
{\r
\r
private void CalcDamage(dynamic json, bool surfaceFleet = false)\r
{\r
+ AirBattleResults = new AirBattleResult();\r
var fc = _guard.Length > 0;\r
var ec = _enemyGuardHp.Length > 0;\r
var both = fc && ec;\r
if (json.api_injection_kouku()) // 噴式強襲\r
CalcKoukuDamage(json.api_injection_kouku);\r
if (json.api_kouku())\r
+ {\r
+ SetAirBattleResult(json.api_kouku);\r
CalcKoukuDamage(json.api_kouku);\r
+ }\r
if (json.api_kouku2()) // 航空戦2回目\r
CalcKoukuDamage(json.api_kouku2);\r
if (!json.api_opening_atack()) // 航空戦のみ\r
CalcKoukuDamage(entry);\r
}\r
\r
+ private void SetAirBattleResult(dynamic json)\r
+ {\r
+ if (json.api_stage1 == null || json.api_stage2 == null)\r
+ return;\r
+ AirBattleResults.Stage1 = new AirBattleResult.StageResult\r
+ {\r
+ FriendCount = (int)json.api_stage1.api_f_count,\r
+ FriendLost = (int)json.api_stage1.api_f_lostcount,\r
+ EnemyCount = (int)json.api_stage1.api_e_count,\r
+ EnemyLost = (int)json.api_stage1.api_e_lostcount\r
+ };\r
+ AirBattleResults.Stage2 = new AirBattleResult.StageResult\r
+ {\r
+ FriendCount = (int)json.api_stage2.api_f_count,\r
+ FriendLost = (int)json.api_stage2.api_f_lostcount,\r
+ EnemyCount = (int)json.api_stage2.api_e_count,\r
+ EnemyLost = (int)json.api_stage2.api_e_lostcount\r
+ };\r
+ }\r
+\r
private void CalcKoukuDamage(dynamic json)\r
{\r
if (!json.api_stage3() || json.api_stage3 == null)\r
<Compile Include="AntiAirPanel.cs">\r
<SubType>Component</SubType>\r
</Compile>\r
+ <Compile Include="AirBattleResultPanel.cs" />\r
<Compile Include="BaseAirCoprs.cs" />\r
<Compile Include="BattleInfo.cs" />\r
<Compile Include="Config.cs" />\r
this.label1Fleet3 = new System.Windows.Forms.Label();\r
this.labelFleet2 = new System.Windows.Forms.Label();\r
this.labelFleet1 = new System.Windows.Forms.Label();\r
- this.fleetPanel = new KancolleSniffer.FleetPanel();\r
+ this.airBattleResultPanel = new KancolleSniffer.AirBattleResultPanel();\r
this.antiAirPanel = new KancolleSniffer.AntiAirPanel();\r
+ this.fleetPanel = new KancolleSniffer.FleetPanel();\r
this.itemTreeView = new KancolleSniffer.ItemTreeView();\r
this.shipListPanel = new KancolleSniffer.ShipListPanel();\r
this.contextMenuStripShipList.SuspendLayout();\r
this.labelFleet1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;\r
this.labelFleet1.Click += new System.EventHandler(this.labelFleet_Click);\r
// \r
+ // airBattleResultPanel\r
+ // \r
+ this.airBattleResultPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
+ this.airBattleResultPanel.Location = new System.Drawing.Point(6, 23);\r
+ this.airBattleResultPanel.Name = "airBattleResultPanel";\r
+ this.airBattleResultPanel.Size = new System.Drawing.Size(238, 51);\r
+ this.airBattleResultPanel.TabIndex = 18;\r
+ // \r
// antiAirPanel\r
// \r
this.antiAirPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) \r
| System.Windows.Forms.AnchorStyles.Left)));\r
this.antiAirPanel.AutoScroll = true;\r
this.antiAirPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
- this.antiAirPanel.Location = new System.Drawing.Point(6, 23);\r
+ this.antiAirPanel.Location = new System.Drawing.Point(6, 73);\r
this.antiAirPanel.Name = "antiAirPanel";\r
- this.antiAirPanel.Size = new System.Drawing.Size(238, 263);\r
+ this.antiAirPanel.Size = new System.Drawing.Size(238, 213);\r
this.antiAirPanel.TabIndex = 17;\r
// \r
// fleetPanel\r
// \r
- this.fleetPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\r
+ this.fleetPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) \r
| System.Windows.Forms.AnchorStyles.Left)));\r
this.fleetPanel.AutoScroll = true;\r
this.fleetPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
this.ClientSize = new System.Drawing.Size(250, 292);\r
this.Controls.Add(this.panelFleetHeader);\r
+ this.Controls.Add(this.airBattleResultPanel);\r
this.Controls.Add(this.antiAirPanel);\r
this.Controls.Add(this.panelItemHeader);\r
this.Controls.Add(this.panelRepairHeader);\r
private System.Windows.Forms.Label labelFleet2;\r
private System.Windows.Forms.Label labelFleet1;\r
private AntiAirPanel antiAirPanel;\r
+ private AirBattleResultPanel airBattleResultPanel;\r
}\r
}
\ No newline at end of file
itemTreeView.Visible = itemTreeView.Enabled = InItemList;\r
fleetPanel.Visible = fleetPanel.Enabled = InFleetInfo;\r
antiAirPanel.Visible = antiAirPanel.Enabled = InAntiAir;\r
+ airBattleResultPanel.Visible = airBattleResultPanel.Enabled = InAntiAir;\r
richTextBoxMiscText.Visible = InMiscText;\r
if (InItemList)\r
{\r
}\r
}\r
\r
+ public void UpdateAirBattleResult()\r
+ {\r
+ airBattleResultPanel.SetResult(_sniffer.Battle.AirBattleResults);\r
+ }\r
+\r
private void SetHeaderSortOrder()\r
{\r
switch (_config.ShipList.SortOrder)\r
labelFighterPower.ForeColor = color[battle.AirControlLevel + 1];\r
if (_config.AlwaysShowResultRank)\r
ShowResultRank();\r
+ _listForm.UpdateAirBattleResult();\r
}\r
\r
private void ShowResultRank()\r