From 5668fca7bed432585389dc1b15397fd002c8541c Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Wed, 24 Jan 2018 20:24:19 +0900 Subject: [PATCH] =?utf8?q?=E8=88=AA=E7=A9=BA=E6=88=A6=E3=81=AE=E7=B5=90?= =?utf8?q?=E6=9E=9C=E3=81=AB=E5=AF=BE=E7=A9=BA=E3=82=AB=E3=83=83=E3=83=88?= =?utf8?q?=E3=82=A4=E3=83=B3=E3=81=AE=E6=83=85=E5=A0=B1=E3=82=92=E5=8A=A0?= =?utf8?q?=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- KancolleSniffer/AirBattleResultPanel.cs | 50 +++++++++++++++++++++++++++++++-- KancolleSniffer/BattleInfo.cs | 19 +++++++++++-- KancolleSniffer/ShipLabels.cs | 1 + 3 files changed, 64 insertions(+), 6 deletions(-) diff --git a/KancolleSniffer/AirBattleResultPanel.cs b/KancolleSniffer/AirBattleResultPanel.cs index 9baa0a4..6a445f7 100644 --- a/KancolleSniffer/AirBattleResultPanel.cs +++ b/KancolleSniffer/AirBattleResultPanel.cs @@ -32,10 +32,18 @@ namespace KancolleSniffer public int EnemyLost { get; set; } } + public class AirFireResult + { + public string ShipName { get; set; } + public int Kind { get; set; } + public string[] Items { get; set; } + } + public string PhaseName { get; set; } public int AirControlLevel { get; set; } - public StageResult Stage1 { get; set; } = new StageResult(); - public StageResult Stage2 { get; set; } = new StageResult(); + public StageResult Stage1 { get; set; } + public StageResult Stage2 { get; set; } + public AirFireResult AirFire { get; set; } } [DesignerCategory("Code")] @@ -46,6 +54,9 @@ namespace KancolleSniffer private readonly Label[][][] _resultLabels = new Label[2][][]; private AirBattleResult[] _resultList; private int _resultIndex; + private readonly ShipLabel _ciShipName; + private readonly Label _ciKind; + private readonly ToolTip _toolTip = new ToolTip{ShowAlways = true}; public bool ShowResultAutomatic { get; set; } @@ -57,6 +68,7 @@ namespace KancolleSniffer public AirBattleResultPanel() { const int top = 20; + const int ci = 168; var labels = new[] { _phaseName = @@ -70,7 +82,8 @@ namespace KancolleSniffer _stage1 = new Label {Text = "stage1", Location = new Point(8, top), AutoSize = true}, new Label {Text = "stage2", Location = new Point(8, top + 14), AutoSize = true}, new Label {Text = "自軍", Location = new Point(67, 6), AutoSize = true}, - new Label {Text = "敵軍", Location = new Point(122, 6), AutoSize = true} + new Label {Text = "敵軍", Location = new Point(122, 6), AutoSize = true}, + new Label {Text = "CI", Location = new Point(ci, 4), AutoSize = true} }; Controls.AddRange(labels); const int left = 53; @@ -101,6 +114,16 @@ namespace KancolleSniffer }); } } + Controls.Add(_ciShipName = new ShipLabel + { + Location = new Point(ci, top), + Size = new Size((int)ShipNameWidth.CiShipName, 12) + }); + Controls.Add(_ciKind = new Label + { + Location = new Point(ci, top + 14), + Size = new Size(24, 12) + }); _phaseName.Click += PhaseNameOnClick; } @@ -153,6 +176,24 @@ namespace KancolleSniffer labels[1][0].Text = $"{stage.EnemyCount}"; labels[1][1].Text = $"{stage.EnemyCount - stage.EnemyLost}"; } + ShowAirFireResult(); + } + + private void ShowAirFireResult() + { + var result = _resultList[_resultIndex]; + if (result.AirFire == null) + { + _ciShipName.SetName(null); + _ciKind.Text = ""; + _toolTip.SetToolTip(_ciKind, ""); + } + else + { + _ciShipName.SetName(result.AirFire.ShipName, ShipNameWidth.CiShipName); + _ciKind.Text = result.AirFire.Kind.ToString(); + _toolTip.SetToolTip(_ciKind, string.Join("\r\n", result.AirFire.Items)); + } } private void ClearResult() @@ -169,6 +210,9 @@ namespace KancolleSniffer } } } + _ciShipName.SetName(null); + _ciKind.Text = ""; + _toolTip.SetToolTip(_ciKind, ""); } } } \ No newline at end of file diff --git a/KancolleSniffer/BattleInfo.cs b/KancolleSniffer/BattleInfo.cs index 5e9739c..04dddc4 100644 --- a/KancolleSniffer/BattleInfo.cs +++ b/KancolleSniffer/BattleInfo.cs @@ -357,7 +357,7 @@ namespace KancolleSniffer var stage1 = json.api_stage1; if (stage1 == null || (stage1.api_f_count == 0 && stage1.api_e_count == 0)) return; - AirBattleResults.Add(new AirBattleResult + var result = new AirBattleResult { PhaseName = phaseName, AirControlLevel = json.api_stage1.api_disp_seiku() ? (int)json.api_stage1.api_disp_seiku : 0, @@ -383,7 +383,19 @@ namespace KancolleSniffer EnemyCount = (int)json.api_stage2.api_e_count, EnemyLost = (int)json.api_stage2.api_e_lostcount } - }); + }; + if (json.api_stage2 != null && json.api_stage2.api_air_fire()) + { + var airfire = json.api_stage2.api_air_fire; + var idx = (int)airfire.api_idx; + result.AirFire = new AirBattleResult.AirFireResult + { + ShipName = idx < _friend.Length ? _friend[idx].Name : _guard[idx - 6].Name, + Kind = (int)airfire.api_kind, + Items = ((int[])airfire.api_use_items).Select(id => _itemInfo.GetSpecByItemId(id).Name).ToArray() + }; + } + AirBattleResults.Add(result); } private void CalcKoukuDamage(dynamic json) @@ -538,7 +550,8 @@ namespace KancolleSniffer public int NowHp => _status.NowHp; public bool Escaped => _status.Escaped; public ShipStatus.Damage DamageLevel => _status.DamageLevel; - public int StartHp; + public string Name => _status.Name; + public int StartHp { get; private set; } public static Record[] Setup(ShipStatus[] ships, bool practice) => (from s in ships diff --git a/KancolleSniffer/ShipLabels.cs b/KancolleSniffer/ShipLabels.cs index 6624224..b512b40 100644 --- a/KancolleSniffer/ShipLabels.cs +++ b/KancolleSniffer/ShipLabels.cs @@ -34,6 +34,7 @@ namespace KancolleSniffer GroupConfig = 82, Combined = 54, BattleResult = 65, + CiShipName = 65, Max = int.MaxValue } -- 2.11.0