\r
using System.Collections.Generic;\r
using System.Drawing;\r
-using System.Linq;\r
using System.Windows.Forms;\r
+using KancolleSniffer.Forms;\r
+using KancolleSniffer.Model;\r
\r
namespace KancolleSniffer.View.ShipListPanel\r
{\r
\r
private class RepairLabels : ShipLabels\r
{\r
- public ShipLabel Time { get; set; }\r
+ public ShipLabel.RepairTime Time { get; set; }\r
public Label PerHp { get; set; }\r
\r
- public override Control[] Controls => base.Controls.Concat(new[] {Time, PerHp}).ToArray();\r
+ protected override Control[] AddedControls => new Control[] {Time, PerHp};\r
+\r
+ public override void Set(ShipStatus status)\r
+ {\r
+ base.Set(status);\r
+ Time.Set(status);\r
+ }\r
}\r
\r
public RepairListLabels(ShipListPanel shipListPanel)\r
var labels = new RepairLabels\r
{\r
Fleet = new ShipLabel.Fleet(new Point(1, 2)),\r
- Name = new ShipLabel.Name(new Point(10, 2)),\r
+ Name = new ShipLabel.Name(new Point(10, 2), ShipNameWidth.RepairListFull),\r
Hp = new ShipLabel.Hp(new Point(118, 0), ShipListPanel.LineHeight),\r
Level = new ShipLabel.Level(new Point(116, 2), height),\r
- Time = new ShipLabel {Location = new Point(141, 2), AutoSize = true},\r
- PerHp = new Label {Location = new Point(186, 2), AutoSize = true},\r
+ Time = new ShipLabel.RepairTime(new Point(141, 2)),\r
+ PerHp = new Label {Location = new Point(185, 2), AutoSize = true},\r
BackPanel = new Panel\r
{\r
Location = new Point(0, y),\r
- Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight)\r
+ Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight),\r
+ Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top\r
}\r
};\r
+ SetAnchorRight(labels.Hp, labels.Level, labels.Time, labels.PerHp);\r
_labelList.Add(labels);\r
labels.Arrange(_shipListPanel, CustomColors.ColumnColors.BrightFirst(i));\r
+ labels.Scale();\r
_shipListPanel.SetHpPercent(labels.Hp);\r
}\r
\r
+ private void SetAnchorRight(params Control[] controls)\r
+ {\r
+ foreach (var control in controls)\r
+ control.Anchor = AnchorStyles.Top | AnchorStyles.Right;\r
+ }\r
+\r
+ public void Resize(int i, int width)\r
+ {\r
+ var labels = _labelList[i];\r
+ labels.BackPanel.Width = width;\r
+ labels.Hp.AdjustLocation();\r
+ labels.Name.AdjustWidth(Scaler.DownWidth(width) - ListForm.PanelWidth);\r
+ }\r
+\r
public void SetRepairList(int i)\r
{\r
var s = _shipListPanel.GetShip(i);\r
return;\r
}\r
var labels = _labelList[i];\r
- labels.Fleet.SetFleet(s);\r
- labels.Name.SetName(s, ShipNameWidth.RepairListFull);\r
- labels.Hp.SetHp(s);\r
- labels.Level.SetLevel(s);\r
- labels.Time.SetRepairTime(s);\r
+ labels.Set(s);\r
labels.PerHp.Text = s.RepairTimePerHp.ToString(@"mm\:ss");\r
labels.BackPanel.Visible = true;\r
}\r