var fn = new[] {"", "1", "2", "3", "4"};\r
for (var i = 0; i < num; i++)\r
{\r
- var e = list[i];\r
+ var s = list[i];\r
var labels = _damagedShipList[i];\r
- labels[fleet].Text = fn[e.Fleet + 1];\r
- labels[name].SetName(e.Name);\r
- var t = e.RepairTime;\r
- labels[time].Text = string.Format(@"{0:d2}:{1:mm\:ss}", (int)t.TotalHours, t);\r
- labels[damage].BackColor = (int)e.DamageLevel == 0\r
+ labels[fleet].Text = fn[s.Fleet + 1];\r
+ labels[name].SetName(s);\r
+ labels[time].SetRepairTime(s);\r
+ labels[damage].BackColor = (int)s.DamageLevel == 0\r
? labels[damage].PresetColor\r
- : colors[(int)e.DamageLevel - 1];\r
+ : colors[(int)s.DamageLevel - 1];\r
}\r
}\r
\r
\r
public TimeSpan CalcRepairTime(int damage)\r
{\r
- var weight = Spec.RepairWeight;\r
- var level = Level < 12 ? Level * 10 : Level * 5 + Math.Floor(Math.Sqrt(Level - 11)) * 10 + 50;\r
- return TimeSpan.FromSeconds(Math.Floor(level * weight * damage) + 30);\r
+ return TimeSpan.FromSeconds(RepairSecPerHp * damage + 30);\r
+ }\r
+\r
+ public double RepairSecPerHp\r
+ {\r
+ get\r
+ {\r
+ var weight = Spec.RepairWeight;\r
+ var level = Level < 12 ? Level * 10 : Level * 5 + Math.Floor(Math.Sqrt(Level - 11)) * 10 + 50;\r
+ return level * weight;\r
+ }\r
}\r
}\r
\r
{\r
Text = status.ExpToNext.ToString("D");\r
}\r
+\r
+ public void SetRepairTime(ShipStatus status)\r
+ {\r
+ var t = status.RepairTime;\r
+ Text = string.Format(@"{0:d2}:{1:mm\:ss}", (int)t.TotalHours, t);\r
+ }\r
}\r
}
\ No newline at end of file
this.label7 = new System.Windows.Forms.Label();\r
this.label6 = new System.Windows.Forms.Label();\r
this.comboBoxGroup = new System.Windows.Forms.ComboBox();\r
+ this.label11 = new System.Windows.Forms.Label();\r
+ this.label12 = new System.Windows.Forms.Label();\r
+ this.label13 = new System.Windows.Forms.Label();\r
+ this.panelRepairHeader = new System.Windows.Forms.Panel();\r
+ this.label10 = new System.Windows.Forms.Label();\r
this.panelGroupHeader.SuspendLayout();\r
+ this.panelRepairHeader.SuspendLayout();\r
this.SuspendLayout();\r
// \r
// panelShipList\r
this.panelGroupHeader.Controls.Add(this.label8);\r
this.panelGroupHeader.Controls.Add(this.label7);\r
this.panelGroupHeader.Controls.Add(this.label6);\r
- this.panelGroupHeader.Location = new System.Drawing.Point(104, 3);\r
+ this.panelGroupHeader.Location = new System.Drawing.Point(103, 3);\r
this.panelGroupHeader.Name = "panelGroupHeader";\r
- this.panelGroupHeader.Size = new System.Drawing.Size(136, 19);\r
+ this.panelGroupHeader.Size = new System.Drawing.Size(137, 19);\r
this.panelGroupHeader.TabIndex = 16;\r
this.panelGroupHeader.Visible = false;\r
// \r
// label9\r
// \r
this.label9.AutoSize = true;\r
- this.label9.Location = new System.Drawing.Point(103, 5);\r
+ this.label9.Location = new System.Drawing.Point(104, 5);\r
this.label9.Name = "label9";\r
this.label9.Size = new System.Drawing.Size(13, 12);\r
this.label9.TabIndex = 4;\r
// label8\r
// \r
this.label8.AutoSize = true;\r
- this.label8.Location = new System.Drawing.Point(73, 5);\r
+ this.label8.Location = new System.Drawing.Point(74, 5);\r
this.label8.Name = "label8";\r
this.label8.Size = new System.Drawing.Size(13, 12);\r
this.label8.TabIndex = 3;\r
// label7\r
// \r
this.label7.AutoSize = true;\r
- this.label7.Location = new System.Drawing.Point(43, 5);\r
+ this.label7.Location = new System.Drawing.Point(44, 5);\r
this.label7.Name = "label7";\r
this.label7.Size = new System.Drawing.Size(13, 12);\r
this.label7.TabIndex = 2;\r
// label6\r
// \r
this.label6.AutoSize = true;\r
- this.label6.Location = new System.Drawing.Point(13, 5);\r
+ this.label6.Location = new System.Drawing.Point(14, 5);\r
this.label6.Name = "label6";\r
this.label6.Size = new System.Drawing.Size(13, 12);\r
this.label6.TabIndex = 1;\r
"B",\r
"C",\r
"D",\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.comboBoxGroup.SelectedIndexChanged += new System.EventHandler(this.comboBoxGroup_SelectedIndexChanged);\r
this.comboBoxGroup.DropDownClosed += new System.EventHandler(this.comboBoxGroup_DropDownClosed);\r
// \r
+ // label11\r
+ // \r
+ this.label11.AutoSize = true;\r
+ this.label11.Location = new System.Drawing.Point(1, 5);\r
+ this.label11.Name = "label11";\r
+ this.label11.Size = new System.Drawing.Size(29, 12);\r
+ this.label11.TabIndex = 17;\r
+ this.label11.Text = "耐久";\r
+ // \r
+ // label12\r
+ // \r
+ this.label12.AutoSize = true;\r
+ this.label12.Location = new System.Drawing.Point(28, 5);\r
+ this.label12.Name = "label12";\r
+ this.label12.Size = new System.Drawing.Size(34, 12);\r
+ this.label12.TabIndex = 17;\r
+ this.label12.Text = "レベル";\r
+ // \r
+ // label13\r
+ // \r
+ this.label13.AutoSize = true;\r
+ this.label13.Location = new System.Drawing.Point(68, 5);\r
+ this.label13.Name = "label13";\r
+ this.label13.Size = new System.Drawing.Size(29, 12);\r
+ this.label13.TabIndex = 18;\r
+ this.label13.Text = "入渠";\r
+ // \r
+ // panelRepairHeader\r
+ // \r
+ this.panelRepairHeader.Controls.Add(this.label10);\r
+ this.panelRepairHeader.Controls.Add(this.label13);\r
+ this.panelRepairHeader.Controls.Add(this.label12);\r
+ this.panelRepairHeader.Controls.Add(this.label11);\r
+ this.panelRepairHeader.Location = new System.Drawing.Point(103, 3);\r
+ this.panelRepairHeader.Name = "panelRepairHeader";\r
+ this.panelRepairHeader.Size = new System.Drawing.Size(137, 19);\r
+ this.panelRepairHeader.TabIndex = 2;\r
+ this.panelRepairHeader.Visible = false;\r
+ // \r
+ // label10\r
+ // \r
+ this.label10.AutoSize = true;\r
+ this.label10.Location = new System.Drawing.Point(102, 5);\r
+ this.label10.Name = "label10";\r
+ this.label10.Size = new System.Drawing.Size(35, 12);\r
+ this.label10.TabIndex = 19;\r
+ this.label10.Text = "/耐久";\r
+ // \r
// ShipListForm\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
this.ClientSize = new System.Drawing.Size(263, 262);\r
+ this.Controls.Add(this.panelRepairHeader);\r
this.Controls.Add(this.panelGroupHeader);\r
this.Controls.Add(this.checkBoxShipType);\r
this.Controls.Add(this.label4);\r
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ShipListForm_KeyPress);\r
this.panelGroupHeader.ResumeLayout(false);\r
this.panelGroupHeader.PerformLayout();\r
+ this.panelRepairHeader.ResumeLayout(false);\r
+ this.panelRepairHeader.PerformLayout();\r
this.ResumeLayout(false);\r
this.PerformLayout();\r
\r
private System.Windows.Forms.Label label8;\r
private System.Windows.Forms.Label label7;\r
private System.Windows.Forms.ComboBox comboBoxGroup;\r
+ private System.Windows.Forms.Panel panelRepairHeader;\r
+ private System.Windows.Forms.Label label13;\r
+ private System.Windows.Forms.Label label12;\r
+ private System.Windows.Forms.Label label11;\r
+ private System.Windows.Forms.Label label10;\r
}\r
}
\ No newline at end of file
private readonly List<Panel> _labelPanelList = new List<Panel>();\r
private readonly List<CheckBox[]> _checkBoxesList = new List<CheckBox[]>();\r
private readonly List<Panel> _checkBoxPanelList = new List<Panel>();\r
+ private readonly List<ShipLabel[]> _repairLabelList = new List<ShipLabel[]>();\r
+ private readonly List<Panel> _repairPanelList = new List<Panel>();\r
public const int GroupCount = 4;\r
private readonly HashSet<int>[] _groupSettings = new HashSet<int>[GroupCount];\r
\r
\r
private void CreateList()\r
{\r
- var ships = FilterByGroup(_sniffer.ShipList).ToArray();\r
+ var ships = InRepairList() ?_sniffer.DamagedShipList : FilterByGroup(_sniffer.ShipList).ToArray();\r
if (!_config.ShipList.ShipType)\r
{\r
- _currentList = ships.OrderBy(s => s, new CompareShipByExp()).ToArray();\r
+ _currentList = ships.OrderBy(s => s, new CompareShip(false, InRepairList())).ToArray();\r
return;\r
}\r
var types = from id in (from s in ships select s.Spec.ShipType).Distinct()\r
join stype in _sniffer.ShipTypeList on id equals stype.Id\r
- select new ShipStatus {Spec = new ShipSpec {Name = stype.Name, ShipType = stype.Id}, Level = 1000};\r
- _currentList = ships.Concat(types).OrderBy(s => s, new CompareShipByType()).ToArray();\r
+ select new ShipStatus {Spec = new ShipSpec {Name = stype.Name, ShipType = stype.Id}, Level = 1000, NowHp = -1000};\r
+ _currentList = ships.Concat(types).OrderBy(s => s, new CompareShip(true, InRepairList())).ToArray();\r
}\r
\r
private IEnumerable<ShipStatus> FilterByGroup(IEnumerable<ShipStatus> ships)\r
return from s in ships where _groupSettings[g].Contains(s.Id) select s;\r
}\r
\r
+ private class CompareShip : IComparer<ShipStatus>\r
+ {\r
+ private readonly bool _type;\r
+ private readonly bool _repair;\r
+\r
+ public CompareShip(bool type, bool repair)\r
+ {\r
+ _type = type;\r
+ _repair = repair;\r
+ }\r
+\r
+ public int Compare(ShipStatus a, ShipStatus b)\r
+ {\r
+ if (_type && a.Spec.ShipType != b.Spec.ShipType)\r
+ return a.Spec.ShipType - b.Spec.ShipType;\r
+ if (_repair && a.RepairTime != b.RepairTime)\r
+ return (int)(b.RepairTime - a.RepairTime).TotalSeconds;\r
+ if (a.Level != b.Level)\r
+ return b.Level - a.Level;\r
+ if (a.ExpToNext != b.ExpToNext)\r
+ return a.ExpToNext - b.ExpToNext;\r
+ return a.Spec.Id - b.Spec.Id;\r
+ }\r
+ }\r
+\r
private void CreateListLabels()\r
{\r
panelShipList.SuspendLayout();\r
for (var i = _labelList.Count; i < _currentList.Length; i++)\r
{\r
CreateCheckBoxes(i);\r
+ CreateRepairLabels(i);\r
CreateShipLabels(i);\r
}\r
panelShipList.ResumeLayout();\r
panelShipList.Controls.Add(cbp);\r
}\r
\r
+ private void CreateRepairLabels(int i)\r
+ {\r
+ var y = 3 + LineHeight * i;\r
+ const int height = LabelHeight;\r
+ var rpp = new Panel\r
+ {\r
+ Location = new Point(128, y),\r
+ Size = new Size(PanelWidth - 128, height),\r
+ BackColor = ShipInfoLabels.ColumnColors[(i + 1) % 2],\r
+ Visible = false\r
+ };\r
+ rpp.Scale(ShipLabel.ScaleFactor);\r
+ rpp.Tag = rpp.Location.Y;\r
+ var rpl = new[]\r
+ {\r
+ new ShipLabel\r
+ {\r
+ Location = new Point(1, 1),\r
+ Size = new Size(23, height),\r
+ TextAlign = ContentAlignment.MiddleRight\r
+ },\r
+ new ShipLabel\r
+ {\r
+ Location = new Point(27, 1),\r
+ Size = new Size(45, height),\r
+ TextAlign = ContentAlignment.MiddleRight\r
+ },\r
+ new ShipLabel {Location = new Point(73, 1), AutoSize = true}\r
+ };\r
+ foreach (var label in rpl)\r
+ {\r
+ label.Scale(ShipLabel.ScaleFactor);\r
+ label.PresetColor =\r
+ label.BackColor = ShipInfoLabels.ColumnColors[(i + 1) % 2];\r
+ }\r
+ _repairLabelList.Add(rpl);\r
+ _repairPanelList.Add(rpp);\r
+// ReSharper disable once CoVariantArrayConversion\r
+ rpp.Controls.AddRange(rpl);\r
+ panelShipList.Controls.Add(rpp);\r
+ }\r
+\r
private void CreateShipLabels(int i)\r
{\r
var y = 3 + LineHeight * i;\r
labels[0].SizeChanged += labelHP_SizeChanged;\r
}\r
\r
- private class CompareShipByExp : IComparer<ShipStatus>\r
- {\r
- public int Compare(ShipStatus a, ShipStatus b)\r
- {\r
- if (a.Level != b.Level)\r
- return b.Level - a.Level;\r
- if (a.ExpToNext != b.ExpToNext)\r
- return a.ExpToNext - b.ExpToNext;\r
- return a.Spec.Id - b.Spec.Id;\r
- }\r
- }\r
-\r
- private class CompareShipByType : IComparer<ShipStatus>\r
- {\r
- public int Compare(ShipStatus a, ShipStatus b)\r
- {\r
- if (a.Spec.ShipType != b.Spec.ShipType)\r
- return a.Spec.ShipType - b.Spec.ShipType;\r
- if (a.Level != b.Level)\r
- return b.Level - a.Level;\r
- if (a.ExpToNext != b.ExpToNext)\r
- return a.ExpToNext - b.ExpToNext;\r
- return a.Spec.Id - b.Spec.Id;\r
- }\r
- }\r
-\r
private void SetShipLabels()\r
{\r
panelGroupHeader.Visible = InGroupConfig();\r
+ panelRepairHeader.Visible = InRepairList();\r
panelShipList.SuspendLayout();\r
var fn = new[] {"", "1", "2", "3", "4"};\r
for (var i = 0; i < _currentList.Length; i++)\r
{\r
cbp.Location = new Point(cbp.Left, (int)cbp.Tag + panelShipList.AutoScrollPosition.Y);\r
}\r
+ var rpp = _repairPanelList[i];\r
+ if (rpp.Visible == false && InRepairList())\r
+ {\r
+ rpp.Location = new Point(rpp.Left, (int)rpp.Tag + panelShipList.AutoScrollPosition.Y);\r
+ }\r
var s = _currentList[i];\r
var labels = _labelList[i];\r
if (s.Level == 1000)\r
{\r
cbp.Visible = false;\r
+ rpp.Visible = false;\r
for (var c = 0; c < 6; c++)\r
{\r
labels[c].Text = "";\r
continue;\r
}\r
cbp.Visible = InGroupConfig();\r
+ rpp.Visible = InRepairList();\r
if (InGroupConfig())\r
{\r
var cb = _checkBoxesList[i];\r
for (var j = 0; j < cb.Length; j++)\r
cb[j].Checked = _groupSettings[j].Contains(s.Id);\r
}\r
+ else if (InRepairList())\r
+ {\r
+ var rpl = _repairLabelList[i];\r
+ labels[0].SetHp(s);\r
+ rpl[0].SetLevel(s);\r
+ rpl[1].SetRepairTime(s);\r
+ rpl[2].Text = TimeSpan.FromSeconds(s.RepairSecPerHp).ToString(@"mm\:ss");\r
+ }\r
else\r
{\r
labels[0].SetHp(s);\r
{\r
_labelPanelList[i].Visible = false;\r
_checkBoxPanelList[i].Visible = false;\r
+ _repairPanelList[i].Visible = false;\r
}\r
panelShipList.ResumeLayout();\r
}\r
return comboBoxGroup.Text == "設定";\r
}\r
\r
+ private bool InRepairList()\r
+ {\r
+ return comboBoxGroup.Text == "修復";\r
+ }\r
+\r
private void labelHP_SizeChanged(object sender, EventArgs e)\r
{\r
var label = (Label)sender;\r
break;\r
if (all.Count() > 0)\r
_groupSettings[i].IntersectWith(all);\r
- config.ShipGroup[i] = _groupSettings[i].ToList(); \r
+ config.ShipGroup[i] = _groupSettings[i].ToList();\r
}\r
e.Cancel = true;\r
if (!Visible)\r
\r
private void ShipListForm_KeyPress(object sender, KeyPressEventArgs e)\r
{\r
- var g = Array.FindIndex(new[] {'Z', 'A', 'B', 'C', 'D', 'E'}, x => x == char.ToUpper(e.KeyChar));\r
+ var g = Array.FindIndex(new[] {'Z', 'A', 'B', 'C', 'D', 'E', 'R'}, x => x == char.ToUpper(e.KeyChar));\r
if (g == -1)\r
return;\r
comboBoxGroup.SelectedIndex = g;\r