1 // Copyright (C) 2019 Kazuhiro Fujieda <fujieda@users.osdn.me>
\r
3 // Licensed under the Apache License, Version 2.0 (the "License");
\r
4 // you may not use this file except in compliance with the License.
\r
5 // You may obtain a copy of the License at
\r
7 // http://www.apache.org/licenses/LICENSE-2.0
\r
9 // Unless required by applicable law or agreed to in writing, software
\r
10 // distributed under the License is distributed on an "AS IS" BASIS,
\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 // See the License for the specific language governing permissions and
\r
13 // limitations under the License.
\r
15 using System.Collections.Generic;
\r
16 using System.Drawing;
\r
18 using System.Windows.Forms;
\r
20 namespace KancolleSniffer.View.ShipListPanel
\r
22 public class RepairListLabels
\r
24 private readonly ShipListPanel _shipListPanel;
\r
25 private readonly List<RepairLabels> _labelList = new List<RepairLabels>();
\r
27 private class RepairLabels : ShipLabels
\r
29 public ShipLabel Time { get; set; }
\r
30 public ShipLabel PerHp { get; set; }
\r
32 public override Control[] Controls => base.Controls.Concat(new[] {Time, PerHp}).ToArray();
\r
35 public RepairListLabels(ShipListPanel shipListPanel)
\r
37 _shipListPanel = shipListPanel;
\r
40 public void CreateLabels(int i)
\r
42 var y = ShipListPanel.LineHeight * i + 1;
\r
43 const int height = ShipListPanel.LabelHeight;
\r
44 var labels = new RepairLabels
\r
46 Fleet = new ShipLabel {Location = new Point(1, 2), AutoSize = true},
\r
47 Name = new ShipLabel {Location = new Point(10, 2), AutoSize = true},
\r
50 Location = new Point(118, 0),
\r
53 MinimumSize = new Size(0, ShipListPanel.LineHeight),
\r
54 TextAlign = ContentAlignment.MiddleLeft,
\r
55 Cursor = Cursors.Hand
\r
57 Level = new ShipLabel
\r
59 Location = new Point(116, 2),
\r
60 Size = new Size(24, height),
\r
61 TextAlign = ContentAlignment.MiddleRight
\r
63 Time = new ShipLabel {Location = new Point(141, 2), AutoSize = true},
\r
64 PerHp = new ShipLabel {Location = new Point(186, 2), AutoSize = true},
\r
65 BackPanel = new Panel
\r
67 Location = new Point(0, y),
\r
68 Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight)
\r
71 _labelList.Add(labels);
\r
72 labels.Arrange(_shipListPanel, CustomColors.ColumnColors.BrightFirst(i));
\r
73 _shipListPanel.SetHpPercent(labels.Hp);
\r
76 public void SetRepairList(int i)
\r
78 var s = _shipListPanel.GetShip(i);
\r
79 if (s.Level == 1000)
\r
81 _shipListPanel.SetShipType(i);
\r
84 var labels = _labelList[i];
\r
85 labels.Fleet.SetFleet(s);
\r
86 labels.Name.SetName(s, ShipNameWidth.RepairListFull);
\r
88 labels.Level.SetLevel(s);
\r
89 labels.Time.SetRepairTime(s);
\r
90 labels.PerHp.Text = s.RepairTimePerHp.ToString(@"mm\:ss");
\r
91 labels.BackPanel.Visible = true;
\r
94 public void HidePanel(int i)
\r
96 _labelList[i].BackPanel.Visible = false;
\r