SniffLogFile(sniffer, "createitem_001");\r
PAssert.That(() => sniffer.Item.NowEquips == 606);\r
}\r
+\r
+ /// <summary>\r
+ /// 海域ゲージ情報を作成する\r
+ /// </summary>\r
+ [TestMethod]\r
+ public void MapInfo()\r
+ {\r
+ var sniffer = new Sniffer();\r
+ SniffLogFile(sniffer, "mapinfo_001");\r
+ PAssert.That(() => sniffer.MiscText ==\r
+ "[海域ゲージ]\r\n" +\r
+ "1-6 : 撃破 3/7\r\n5-5 : 撃破 0/5\r\n6-3 : 撃破 0/4\r\n" +\r
+ "31-1 : HP 0/750\r\n31-2 : HP 0/1050\r\n31-3 : HP 0/2100\r\n31-4 : HP 0/3500\r\n31-5 : HP 1/2450\r\n",\r
+ "最初の海域ゲージ情報");\r
+ SniffLogFile(sniffer, "mapinfo_002");\r
+ PAssert.That(() => sniffer.MiscText == "", "戦闘から戻ったらクリア");\r
+ SniffLogFile(sniffer, "mapinfo_003");\r
+ PAssert.That(() => sniffer.MiscText ==\r
+ "[海域ゲージ]\r\n" +\r
+ "1-6 : 撃破 4/7\r\n5-5 : 撃破 0/5\r\n6-3 : 撃破 0/4\r\n" +\r
+ "31-1 : HP 0/750\r\n31-2 : HP 0/1050\r\n31-3 : HP 0/2100\r\n31-4 : HP 0/3500\r\n31-5 : HP 1/2450\r\n",\r
+ "更新された海域ゲージ情報");\r
+ }\r
}\r
}
\ No newline at end of file
</Compile>\r
<Compile Include="Logger.cs" />\r
<Compile Include="LogServer.cs" />\r
+ <Compile Include="MiscTextInfo.cs" />\r
<Compile Include="MissingData.cs" />\r
<Compile Include="ShipLabels.cs" />\r
<Compile Include="ShipListForm.cs">\r
--- /dev/null
+// Copyright (C) 2015 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
+//\r
+// This program is part of KancolleSniffer.\r
+//\r
+// KancolleSniffer is free software: you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation, either version 3 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, see <http://www.gnu.org/licenses/>.\r
+\r
+using System.Collections.Generic;\r
+\r
+namespace KancolleSniffer\r
+{\r
+ public class MiscTextInfo\r
+ {\r
+ public string Text { get; private set; }\r
+ public bool ClearFlag { private get; set; }\r
+\r
+ public void ClearIfNeeded()\r
+ {\r
+ if (!ClearFlag)\r
+ return;\r
+ Text = "";\r
+ ClearFlag = false;\r
+ }\r
+\r
+ private readonly Dictionary<int, int> _required = new Dictionary<int, int>\r
+ {\r
+ {15, 4},\r
+ {16, 7},\r
+ {25, 4},\r
+ {35, 4},\r
+ {44, 4},\r
+ {45, 5},\r
+ {52, 4},\r
+ {53, 5},\r
+ {54, 5},\r
+ {55, 5},\r
+ {62, 3},\r
+ {63, 4}\r
+ };\r
+\r
+ public void InspectMapInfo(dynamic json)\r
+ {\r
+ Text = "[海域ゲージ]\r\n";\r
+ foreach (var entry in json)\r
+ {\r
+ var map = (int)entry.api_id;\r
+ if (entry.api_eventmap())\r
+ {\r
+ var evmap = entry.api_eventmap;\r
+ Text += $"{map / 10}-{map % 10} : HP {(int)evmap.api_now_maphp}/{(int)evmap.api_max_maphp}\r\n";\r
+ continue;\r
+ }\r
+ if (!entry.api_defeat_count())\r
+ continue;\r
+ int req;\r
+ var reqStr = _required.TryGetValue(map, out req) ? req.ToString() : "?";\r
+ Text += $"{map / 10}-{map % 10} : 撃破 {(int)entry.api_defeat_count}/{reqStr}\r\n";\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file
this.label10 = new System.Windows.Forms.Label();\r
this.label11 = new System.Windows.Forms.Label();\r
this.panelItemHeader = new System.Windows.Forms.Panel();\r
+ this.textBoxMiscText = new System.Windows.Forms.TextBox();\r
this.equipPanel = new KancolleSniffer.EquipPanel();\r
this.itemTreeView = new KancolleSniffer.ItemTreeView();\r
this.panelShipList.SuspendLayout();\r
| System.Windows.Forms.AnchorStyles.Left)));\r
this.panelShipList.AutoScroll = true;\r
this.panelShipList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
+ this.panelShipList.Controls.Add(this.textBoxMiscText);\r
this.panelShipList.Controls.Add(this.equipPanel);\r
this.panelShipList.Controls.Add(this.itemTreeView);\r
this.panelShipList.Location = new System.Drawing.Point(6, 23);\r
"分類",\r
"修復",\r
"装備",\r
- "艦隊"});\r
+ "艦隊",\r
+ "情報"});\r
this.comboBoxGroup.Location = new System.Drawing.Point(6, 4);\r
this.comboBoxGroup.Name = "comboBoxGroup";\r
this.comboBoxGroup.Size = new System.Drawing.Size(48, 20);\r
this.panelItemHeader.Size = new System.Drawing.Size(166, 19);\r
this.panelItemHeader.TabIndex = 0;\r
// \r
+ // textBoxMiscText\r
+ // \r
+ this.textBoxMiscText.Dock = System.Windows.Forms.DockStyle.Fill;\r
+ this.textBoxMiscText.Location = new System.Drawing.Point(0, 0);\r
+ this.textBoxMiscText.Multiline = true;\r
+ this.textBoxMiscText.Name = "textBoxMiscText";\r
+ this.textBoxMiscText.ReadOnly = true;\r
+ this.textBoxMiscText.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;\r
+ this.textBoxMiscText.Size = new System.Drawing.Size(236, 261);\r
+ this.textBoxMiscText.TabIndex = 0;\r
+ // \r
// equipPanel\r
// \r
this.equipPanel.AutoScroll = true;\r
this.Load += new System.EventHandler(this.ShipListForm_Load);\r
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ShipListForm_KeyPress);\r
this.panelShipList.ResumeLayout(false);\r
+ this.panelShipList.PerformLayout();\r
this.panelGroupHeader.ResumeLayout(false);\r
this.panelGroupHeader.PerformLayout();\r
this.panelRepairHeader.ResumeLayout(false);\r
private System.Windows.Forms.Panel panelItemHeader;\r
private EquipPanel equipPanel;\r
private ItemTreeView itemTreeView;\r
+ private System.Windows.Forms.TextBox textBoxMiscText;\r
}\r
}
\ No newline at end of file
\r
public void UpdateList()\r
{\r
- panelItemHeader.Visible = InItemList || InEquip;\r
+ panelItemHeader.Visible = InItemList || InEquip || InMiscText;\r
itemTreeView.Visible = InItemList;\r
equipPanel.Visible = InEquip;\r
+ textBoxMiscText.Visible = InMiscText;\r
if (InItemList)\r
{\r
HideShipLabels();\r
HideShipLabels();\r
equipPanel.UpdateEquip(_sniffer);\r
}\r
+ else if (InMiscText)\r
+ {\r
+ HideShipLabels();\r
+ textBoxMiscText.Text = _sniffer.MiscText;\r
+ }\r
else\r
{\r
CreateShipList();\r
\r
private bool InEquip => comboBoxGroup.Text == "艦隊";\r
\r
+ private bool InMiscText => comboBoxGroup.Text == "情報";\r
+\r
private void ShipListForm_Load(object sender, EventArgs e)\r
{\r
panelShipList.Width = (int)Round(PanelWidth * ShipLabel.ScaleFactor.Width) + 3 +\r
\r
private void ShipListForm_KeyPress(object sender, KeyPressEventArgs e)\r
{\r
- var g = Array.FindIndex(new[] {'Z', 'A', 'B', 'C', 'D', 'G', 'R', 'W', 'X'},\r
+ var g = Array.FindIndex(new[] {'Z', 'A', 'B', 'C', 'D', 'G', 'R', 'W', 'X', 'I'},\r
x => x == char.ToUpper(e.KeyChar));\r
if (g == -1)\r
return;\r
private readonly BattleInfo _battleInfo;\r
private readonly Logger _logger;\r
private readonly ExMapInfo _exMapInfo = new ExMapInfo();\r
+ private readonly MiscTextInfo _miscTextInfo = new MiscTextInfo();\r
private readonly Status _status = new Status();\r
private bool _saveState;\r
private readonly List<IHaveState> _haveState;\r
Mission = 32,\r
QuestList = 64,\r
Battle = 128,\r
- All = 255\r
+ All = 255,\r
}\r
\r
public Sniffer()\r
_battleInfo.InBattle = false;\r
_battleInfo.HasDamagedShip = false;\r
_shipInfo.ClearEscapedShips();\r
+ _miscTextInfo.ClearIfNeeded();\r
SaveState();\r
return Update.All;\r
}\r
if (url.EndsWith("api_req_practice/battle_result"))\r
{\r
_battleInfo.InspectPracticeResult(json);\r
+\r
return Update.Ship;\r
}\r
if (IsCombinedBattleAPI(url))\r
_conditionTimer.InvalidateCond();\r
_exMapInfo.InspectMapStart(data);\r
_logger.InspectMapStart(data);\r
+ _miscTextInfo.ClearFlag = true;\r
return Update.Timer;\r
}\r
if (url.EndsWith("api_req_map/next"))\r
if (url.EndsWith("api_get_member/mapinfo"))\r
{\r
_exMapInfo.InspectMapInfo(data);\r
- return Update.None;\r
+ _miscTextInfo.InspectMapInfo(data);\r
+ return Update.Item;\r
}\r
return Update.None;\r
}\r
\r
public ExMapInfo ExMap => _exMapInfo;\r
\r
+ public string MiscText => _miscTextInfo.Text;\r
+\r
public void SetLogWriter(Action<string, string, string> writer, Func<DateTime> nowFunc)\r
{\r
_logger.SetWriter(writer, nowFunc);\r