OSDN Git Service

ネタバレオフ時にラベルのクリックで次のセルを表示する
authorKazuhiro Fujieda <fujieda@users.osdn.me>
Tue, 26 Jun 2018 13:31:12 +0000 (22:31 +0900)
committerKazuhiro Fujieda <fujieda@users.osdn.me>
Fri, 29 Jun 2018 12:56:37 +0000 (21:56 +0900)
KancolleSniffer/BattleResultPanel.cs

index 68e71db..07b1412 100644 (file)
@@ -31,7 +31,8 @@ namespace KancolleSniffer
         private readonly List<ShipLabel> _hpLabels = new List<ShipLabel>();\r
         private readonly ResizableToolTip _toolTip = new ResizableToolTip {ShowAlways = true};\r
         private readonly BattleInfo.BattleResult[] _result = new BattleInfo.BattleResult[2];\r
-        private Label _phaseLabel, _rankLabel, _cellLabel;\r
+        private Label _phaseLabel, _rankLabel;\r
+        private CellInfoLabel _cellLabel;\r
         private BattleState _prevBattleState;\r
         private readonly BattleResultRank[] _rank = new BattleResultRank[2];\r
         private readonly InformationPanel _infomationPanel;\r
@@ -286,13 +287,41 @@ namespace KancolleSniffer
 \r
         public void UpdateCellInfo(Sniffer sniffer)\r
         {\r
-            var text = sniffer.CellInfo;\r
-            if (text == null)\r
-                return;\r
-            if ((Spoilers & Spoiler.NextCell) == 0 && text[0] == '次')\r
-                return;\r
-            _cellLabel.Text = sniffer.CellInfo;\r
-            _cellLabel.Location = new Point(ClientSize.Width - _cellLabel.Width - 2, 4);\r
+            _cellLabel.Update(sniffer);\r
+        }\r
+\r
+        private class CellInfoLabel : Label\r
+        {\r
+            private string _cellInfo;\r
+\r
+            public void Update(Sniffer sniffer)\r
+            {\r
+                var spoilers = ((BattleResultPanel)Parent).Spoilers;\r
+                _cellInfo = sniffer.CellInfo;\r
+                if (_cellInfo == null)\r
+                    return;\r
+                if ((spoilers & Spoiler.NextCell) == 0 && _cellInfo[0] == '次')\r
+                {\r
+                    Text = "次";\r
+                    BorderStyle = BorderStyle.FixedSingle;\r
+                    Location = new Point(Parent.ClientSize.Width - Width - 6, 3);\r
+                    return;\r
+                }\r
+                ShowCellInfo();\r
+            }\r
+\r
+            private void ShowCellInfo()\r
+            {\r
+                Text = _cellInfo;\r
+                BorderStyle = BorderStyle.None;\r
+                Location = new Point(Parent.ClientSize.Width - Width - 2, 4);\r
+            }\r
+\r
+            protected override void OnClick(EventArgs e)\r
+            {\r
+                base.OnClick(e);\r
+                ShowCellInfo();\r
+            }\r
         }\r
 \r
         private void CreateLabels()\r
@@ -310,7 +339,7 @@ namespace KancolleSniffer
                 Size = new Size(42, 12)\r
             };\r
             Controls.Add(_rankLabel);\r
-            _cellLabel = new Label\r
+            _cellLabel = new CellInfoLabel\r
             {\r
                 Location = new Point(0, 4),\r
                 AutoSize = true,\r