コミットメタ情報

リビジョン57f62e7ee31f3c594fe619df1416e8ad4824757f (tree)
日時2018-06-24 13:54:49
作者Kazuhiro Fujieda <fujieda@user...>
コミッターKazuhiro Fujieda

ログメッセージ

次のマスが何戦目かを表示する

変更サマリ

差分

--- a/KancolleSniffer/BattleResultPanel.cs
+++ b/KancolleSniffer/BattleResultPanel.cs
@@ -31,12 +31,12 @@ namespace KancolleSniffer
3131 private readonly List<ShipLabel> _hpLabels = new List<ShipLabel>();
3232 private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};
3333 private readonly BattleInfo.BattleResult[] _result = new BattleInfo.BattleResult[2];
34- private Label _phaseLabel, _rankLabel;
34+ private Label _phaseLabel, _rankLabel, _cellLabel;
3535 private BattleState _prevBattleState;
3636 private readonly BattleResultRank[] _rank = new BattleResultRank[2];
3737 private readonly InformationPanel _infomationPanel;
3838
39- public bool Spoiler { get; set; }
39+ public Spoiler Spoilers { get; set; }
4040
4141 public BattleResultPanel()
4242 {
@@ -76,7 +76,7 @@ namespace KancolleSniffer
7676 }
7777 if (state != BattleState.Day && state != BattleState.Night)
7878 return;
79- if (Spoiler)
79+ if ((Spoilers & Spoiler.BattleResult) != 0)
8080 {
8181 ShowResult(sniffer.Battle.Result);
8282 ShowResultRank(sniffer.Battle.ResultRank);
@@ -284,6 +284,17 @@ namespace KancolleSniffer
284284 _rankLabel.Text = result[(int)rank];
285285 }
286286
287+ public void UpdateCellInfo(Sniffer sniffer)
288+ {
289+ var text = sniffer.CellInfo;
290+ if (text == null)
291+ return;
292+ if ((Spoilers & Spoiler.NextCell) == 0 && text[0] == '次')
293+ return;
294+ _cellLabel.Text = sniffer.CellInfo;
295+ _cellLabel.Location = new Point(ClientSize.Width - _cellLabel.Width - 2, 4);
296+ }
297+
287298 private void CreateLabels()
288299 {
289300 _phaseLabel = new Label
@@ -299,6 +310,12 @@ namespace KancolleSniffer
299310 Size = new Size(42, 12)
300311 };
301312 Controls.Add(_rankLabel);
313+ _cellLabel = new Label
314+ {
315+ Location = new Point(0, 4),
316+ AutoSize = true,
317+ };
318+ Controls.Add(_cellLabel);
302319 for (var i = 0; i < 13; i++)
303320 {
304321 var y = LineHeight * i + 38;
--- /dev/null
+++ b/KancolleSniffer/CellInfo.cs
@@ -0,0 +1,94 @@
1+// Copyright (C) 2018 Kazuhiro Fujieda <fujieda@users.osdn.me>
2+//
3+// Licensed under the Apache License, Version 2.0 (the "License");
4+// you may not use this file except in compliance with the License.
5+// You may obtain a copy of the License at
6+//
7+// http://www.apache.org/licenses/LICENSE-2.0
8+//
9+// Unless required by applicable law or agreed to in writing, software
10+// distributed under the License is distributed on an "AS IS" BASIS,
11+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+// See the License for the specific language governing permissions and
13+// limitations under the License.
14+
15+namespace KancolleSniffer
16+{
17+ public class CellInfo
18+ {
19+ private int _batttleCount;
20+
21+ public string Text { get; set; }
22+
23+ private string _info;
24+
25+ public void Port()
26+ {
27+ Text = _info;
28+ }
29+
30+ public void StartBattle()
31+ {
32+ Text = _info;
33+ }
34+
35+ public void InspectMapStart(dynamic json)
36+ {
37+ _batttleCount = 0;
38+ InspectMapNext(json);
39+ }
40+
41+ public void InspectMapNext(dynamic json)
42+ {
43+ SetInfo(json);
44+ Text = "次" + _info;
45+ }
46+
47+ private void SetInfo(dynamic json)
48+ {
49+ switch ((int)json.api_color_no)
50+ {
51+ case 2:
52+ _info = "資源";
53+ break;
54+ case 3:
55+ _info = "渦潮";
56+ break;
57+ case 4:
58+ switch ((int)json.api_event_id)
59+ {
60+ case 4:
61+ _batttleCount++;
62+ _info = $"{BattleCount}戦目";
63+ break;
64+ case 6:
65+ _info = "気のせい";
66+ break;
67+ }
68+ break;
69+ case 5:
70+ _info = "ボス戦";
71+ break;
72+ case 6:
73+ _info = "揚陸地点";
74+ break;
75+ case 7:
76+ _batttleCount++;
77+ _info = $"{BattleCount}戦目(航空)";
78+ break;
79+ case 8:
80+ _info = "護衛成功";
81+ break;
82+ case 9:
83+ _info = "航空偵察";
84+ break;
85+ case 10:
86+ _batttleCount++;
87+ _info = $"{BattleCount}戦目(空襲)";
88+ break;
89+ }
90+ }
91+
92+ private string BattleCount => ((char)('0' + _batttleCount)).ToString();
93+ }
94+}
\ No newline at end of file
--- a/KancolleSniffer/Config.cs
+++ b/KancolleSniffer/Config.cs
@@ -186,7 +186,8 @@ namespace KancolleSniffer
186186 ResultRank = 1,
187187 AirBattleResult = 1 << 1,
188188 BattleResult = 1 << 2,
189- All = (1 << 3) - 1
189+ NextCell = 1 << 3,
190+ All = (1 << 4) - 1
190191 }
191192
192193 [Flags]
--- a/KancolleSniffer/ConfigDialog.Designer.cs
+++ b/KancolleSniffer/ConfigDialog.Designer.cs
@@ -132,6 +132,7 @@ namespace KancolleSniffer
132132 this.openSoundFileDialog = new System.Windows.Forms.OpenFileDialog();
133133 this.folderBrowserDialogOutputDir = new System.Windows.Forms.FolderBrowserDialog();
134134 this.openDebugLogDialog = new System.Windows.Forms.OpenFileDialog();
135+ this.checkBoxNextCell = new System.Windows.Forms.CheckBox();
135136 this.tabControl.SuspendLayout();
136137 this.tabPageWindow.SuspendLayout();
137138 this.tabPageNotification.SuspendLayout();
@@ -455,6 +456,7 @@ namespace KancolleSniffer
455456 //
456457 // groupBox3
457458 //
459+ this.groupBox3.Controls.Add(this.checkBoxNextCell);
458460 this.groupBox3.Controls.Add(this.checkBoxBattleResult);
459461 this.groupBox3.Controls.Add(this.checkBoxAirBattleResult);
460462 this.groupBox3.Controls.Add(this.checkBoxResultRank);
@@ -469,7 +471,7 @@ namespace KancolleSniffer
469471 // checkBoxBattleResult
470472 //
471473 this.checkBoxBattleResult.AutoSize = true;
472- this.checkBoxBattleResult.Location = new System.Drawing.Point(147, 21);
474+ this.checkBoxBattleResult.Location = new System.Drawing.Point(123, 21);
473475 this.checkBoxBattleResult.Name = "checkBoxBattleResult";
474476 this.checkBoxBattleResult.Size = new System.Drawing.Size(48, 16);
475477 this.checkBoxBattleResult.TabIndex = 2;
@@ -479,7 +481,7 @@ namespace KancolleSniffer
479481 // checkBoxAirBattleResult
480482 //
481483 this.checkBoxAirBattleResult.AutoSize = true;
482- this.checkBoxAirBattleResult.Location = new System.Drawing.Point(84, 21);
484+ this.checkBoxAirBattleResult.Location = new System.Drawing.Point(60, 21);
483485 this.checkBoxAirBattleResult.Name = "checkBoxAirBattleResult";
484486 this.checkBoxAirBattleResult.Size = new System.Drawing.Size(60, 16);
485487 this.checkBoxAirBattleResult.TabIndex = 1;
@@ -491,9 +493,9 @@ namespace KancolleSniffer
491493 this.checkBoxResultRank.AutoSize = true;
492494 this.checkBoxResultRank.Location = new System.Drawing.Point(9, 21);
493495 this.checkBoxResultRank.Name = "checkBoxResultRank";
494- this.checkBoxResultRank.Size = new System.Drawing.Size(72, 16);
496+ this.checkBoxResultRank.Size = new System.Drawing.Size(48, 16);
495497 this.checkBoxResultRank.TabIndex = 0;
496- this.checkBoxResultRank.Text = "勝利判定";
498+ this.checkBoxResultRank.Text = "勝敗";
497499 this.checkBoxResultRank.UseVisualStyleBackColor = true;
498500 //
499501 // groupBox2
@@ -1095,6 +1097,16 @@ namespace KancolleSniffer
10951097 this.openDebugLogDialog.CheckFileExists = false;
10961098 this.openDebugLogDialog.Title = "ログファイルの選択";
10971099 //
1100+ // checkBoxNextCell
1101+ //
1102+ this.checkBoxNextCell.AutoSize = true;
1103+ this.checkBoxNextCell.Location = new System.Drawing.Point(174, 21);
1104+ this.checkBoxNextCell.Name = "checkBoxNextCell";
1105+ this.checkBoxNextCell.Size = new System.Drawing.Size(48, 16);
1106+ this.checkBoxNextCell.TabIndex = 3;
1107+ this.checkBoxNextCell.Text = "進路";
1108+ this.checkBoxNextCell.UseVisualStyleBackColor = true;
1109+ //
10981110 // ConfigDialog
10991111 //
11001112 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1240,5 +1252,6 @@ namespace KancolleSniffer
12401252 private System.Windows.Forms.CheckBox checkBoxBattleResult;
12411253 private System.Windows.Forms.CheckBox checkBoxAirBattleResult;
12421254 private System.Windows.Forms.CheckBox checkBoxResultRank;
1255+ private System.Windows.Forms.CheckBox checkBoxNextCell;
12431256 }
12441257 }
\ No newline at end of file
--- a/KancolleSniffer/ConfigDialog.cs
+++ b/KancolleSniffer/ConfigDialog.cs
@@ -88,6 +88,7 @@ namespace KancolleSniffer
8888 checkBoxResultRank.Checked = (_config.Spoilers & Spoiler.ResultRank) != 0;
8989 checkBoxAirBattleResult.Checked = (_config.Spoilers & Spoiler.AirBattleResult) != 0;
9090 checkBoxBattleResult.Checked = (_config.Spoilers & Spoiler.BattleResult) != 0;
91+ checkBoxNextCell.Checked = (_config.Spoilers & Spoiler.NextCell) != 0;
9192 checkBoxPresetAkashi.Checked = _config.UsePresetAkashi;
9293
9394 numericUpDownSoundVolume.Value = _config.Sounds.Volume;
@@ -190,7 +191,8 @@ namespace KancolleSniffer
190191
191192 _config.Spoilers = (checkBoxResultRank.Checked ? Spoiler.ResultRank : 0) |
192193 (checkBoxAirBattleResult.Checked ? Spoiler.AirBattleResult : 0) |
193- (checkBoxBattleResult.Checked ? Spoiler.BattleResult : 0);
194+ (checkBoxBattleResult.Checked ? Spoiler.BattleResult : 0) |
195+ (checkBoxNextCell.Checked ? Spoiler.NextCell : 0);
194196 _config.UsePresetAkashi = checkBoxPresetAkashi.Checked;
195197
196198 _config.Sounds.Volume = (int)numericUpDownSoundVolume.Value;
--- a/KancolleSniffer/KancolleSniffer.csproj
+++ b/KancolleSniffer/KancolleSniffer.csproj
@@ -67,6 +67,7 @@
6767 <Compile Include="BattleResultPanel.cs">
6868 <SubType>Component</SubType>
6969 </Compile>
70+ <Compile Include="CellInfo.cs" />
7071 <Compile Include="ErrorLog.cs" />
7172 <Compile Include="Config.cs" />
7273 <Compile Include="ConfigDialog.cs">
--- a/KancolleSniffer/ListForm.Designer.cs
+++ b/KancolleSniffer/ListForm.Designer.cs
@@ -425,7 +425,6 @@ namespace KancolleSniffer
425425 this.battleResultPanel.Location = new System.Drawing.Point(6, 73);
426426 this.battleResultPanel.Name = "battleResultPanel";
427427 this.battleResultPanel.Size = new System.Drawing.Size(238, 213);
428- this.battleResultPanel.Spoiler = false;
429428 this.battleResultPanel.TabIndex = 0;
430429 //
431430 // antiAirPanel
--- a/KancolleSniffer/ListForm.cs
+++ b/KancolleSniffer/ListForm.cs
@@ -117,10 +117,16 @@ namespace KancolleSniffer
117117
118118 public void UpdateBattleResult()
119119 {
120- battleResultPanel.Spoiler = (_config.Spoilers & Spoiler.BattleResult) != 0;
120+ battleResultPanel.Spoilers = _config.Spoilers;
121121 battleResultPanel.Update(_sniffer);
122122 }
123123
124+ public void UpdateCellInfo()
125+ {
126+ battleResultPanel.Spoilers = _config.Spoilers;
127+ battleResultPanel.UpdateCellInfo(_sniffer);
128+ }
129+
124130 private void SetHeaderSortOrder()
125131 {
126132 switch (_config.ShipList.SortOrder)
--- a/KancolleSniffer/MainForm.cs
+++ b/KancolleSniffer/MainForm.cs
@@ -284,6 +284,8 @@ namespace KancolleSniffer
284284 UpdateShipInfo();
285285 if ((update & Sniffer.Update.Battle) != 0)
286286 UpdateBattleInfo();
287+ if ((update & Sniffer.Update.Cell) != 0)
288+ UpdateCellInfo();
287289 }
288290
289291 private void MainForm_Load(object sender, EventArgs e)
@@ -707,7 +709,15 @@ namespace KancolleSniffer
707709 if ((_config.Spoilers & Spoiler.ResultRank) != 0)
708710 ShowResultRank();
709711 if (_sniffer.Battle.BattleState == BattleState.Day)
712+ {
710713 _listForm.UpdateAirBattleResult();
714+ _listForm.UpdateCellInfo();
715+ }
716+ }
717+
718+ private void UpdateCellInfo()
719+ {
720+ _listForm.UpdateCellInfo();
711721 }
712722
713723 private void ResetBattleInfo()
--- a/KancolleSniffer/Sniffer.cs
+++ b/KancolleSniffer/Sniffer.cs
@@ -36,6 +36,7 @@ namespace KancolleSniffer
3636 private readonly MiscTextInfo _miscTextInfo;
3737 private readonly BaseAirCoprs _baseAirCoprs;
3838 private readonly PresetDeck _presetDeck = new PresetDeck();
39+ private readonly CellInfo _cellInfo = new CellInfo();
3940 private readonly Status _status = new Status();
4041 private bool _saveState;
4142 private readonly List<IHaveState> _haveState;
@@ -63,7 +64,8 @@ namespace KancolleSniffer
6364 Mission = 1 << 6,
6465 QuestList = 1 << 7,
6566 Battle = 1 << 8,
66- All = (1 << 9) - 1
67+ Cell = 1 << 9,
68+ All = (1 << 10) - 1
6769 }
6870
6971 public Sniffer(bool start = false)
@@ -161,6 +163,7 @@ namespace KancolleSniffer
161163 _battleInfo.BattleState = BattleState.None;
162164 _shipInfo.ClearEscapedShips();
163165 _miscTextInfo.Port();
166+ _cellInfo.Port();
164167 SaveState();
165168 RepeatingTimerController?.Resume();
166169 foreach (var s in new[] {"遠征終了", "入渠終了", "疲労回復", "泊地修理"})
@@ -333,6 +336,7 @@ namespace KancolleSniffer
333336 {
334337 _battleInfo.InspectBattle(url, request, data);
335338 _logger.InspectBattle(data);
339+ _cellInfo.StartBattle();
336340 return Update.Ship | Update.Battle;
337341 }
338342 if (url.EndsWith("api_req_practice/battle") || url.EndsWith("api_req_practice/midnight_battle"))
@@ -474,8 +478,9 @@ namespace KancolleSniffer
474478 _logger.InspectMapStart(data);
475479 _miscTextInfo.InspectMapStart(data);
476480 _questInfo.InspectMapStart(data);
481+ _cellInfo.InspectMapStart(data);
477482 RepeatingTimerController?.Suspend();
478- return Update.Timer | Update.Ship;
483+ return Update.Timer | Update.Ship | Update.Cell;
479484 }
480485 if (url.EndsWith("api_req_map/next"))
481486 {
@@ -484,7 +489,8 @@ namespace KancolleSniffer
484489 _logger.InspectMapNext(data);
485490 _questInfo.InspectMapNext(data);
486491 _miscTextInfo.InspectMapNext(data);
487- return Update.None;
492+ _cellInfo.InspectMapNext(data);
493+ return Update.Cell;
488494 }
489495 if (url.EndsWith("api_req_mission/start"))
490496 {
@@ -593,6 +599,8 @@ namespace KancolleSniffer
593599
594600 public BaseAirCoprs.BaseInfo[] BaseAirCorps => _baseAirCoprs.AllAirCorps;
595601
602+ public string CellInfo => _cellInfo.Text;
603+
596604 public void SetLogWriter(Action<string, string, string> writer, Func<DateTime> nowFunc)
597605 {
598606 _logger.SetWriter(writer, nowFunc);
旧リポジトリブラウザで表示