// limitations under the License.\r
\r
using System;\r
+using System.Collections;\r
using System.Collections.Generic;\r
using System.Drawing;\r
using System.Linq;\r
private const int LineHeight = 14;\r
private const int LabelHeight = 12;\r
private Record[] _table;\r
- private readonly List<ShipLabel[]> _labelList = new List<ShipLabel[]>();\r
+ private readonly List<FleetLabels> _labelList = new List<FleetLabels>();\r
private readonly List<Panel> _panelList = new List<Panel>();\r
private readonly ToolTip _toolTip = new ToolTip {ShowAlways = true};\r
\r
var airspec = "";\r
if (item.Spec.IsDiveBomber) // 爆撃\r
{\r
- airspec = "航空戦 " + (25 + (int)(item.Spec.Bomber * Math.Sqrt(onslot)));\r
+ airspec = "航空戦 " +\r
+ (25 + (int)((item.Spec.Bomber + item.BomberLevelBonus) * Math.Sqrt(onslot)));\r
}\r
else if (item.Spec.IsTorpedoBomber)\r
{\r
var normal = 25 + item.Spec.Torpedo * Math.Sqrt(onslot);\r
airspec = "航空戦 " + (int)(normal * 0.8) + "/" + (int)(normal * 1.5);\r
}\r
+\r
equips.Add(new Record\r
{\r
- Equip = GenEquipString(item, onslot, max),\r
+ Equip = GenEquipString(item),\r
+ Spec = item.Spec.IsAircraft ? $"+{item.Alv} {onslot}/{max}" : "",\r
AircraftSpec = airspec,\r
Color = item.Spec.Color\r
});\r
if (s.SlotEx.Id > 0)\r
{\r
var item = s.SlotEx;\r
- equips.Add(new Record {Equip = item.Spec.Name, Color = item.Spec.Color});\r
+ equips.Add(new Record {Equip = GenEquipString(item), Color = item.Spec.Color});\r
}\r
if (drum != 0)\r
drumShips++;\r
drumTotal += drum;\r
levelTotal += s.Level;\r
- if (f < (sniffer.CombinedFleetType == 3 ? 2 : 1))\r
+ if (f < (sniffer.CombinedFleetType != 0 ? 2 : 1))\r
tp += s.TransportPoint;\r
- var fire = s.RealFirepower;\r
- var subm = s.RealAntiSubmarine;\r
- var torp = s.RealTorpedo;\r
+ var fire = s.EffectiveFirepower;\r
+ var subm = s.EffectiveAntiSubmarine;\r
+ var torp = s.EffectiveTorpedo;\r
var night = s.NightBattlePower;\r
+ var oasa = s.CanOpeningAntiSubmarineAttack ? "*" : "";\r
var ship = new Record\r
{\r
Ship = (s.Escaped ? "[避]" : "") + s.Name + " Lv" + s.Level,\r
Id = s.Id,\r
// ReSharper disable CompareOfFloatsByEqualityOperator\r
- Spec = (fire == 0 ? "" : $"砲{fire:f1}") + (subm == 0 ? "" : $" 潜{subm:f1}"),\r
+ Spec = (fire == 0 ? "" : $"砲{fire:f1}") + (subm == 0 ? "" : $" 潜{subm:f1}{oasa}"),\r
Spec2 = (torp == 0 ? "" : $"雷{torp:f1}") + (night == 0 ? "" : $" 夜{night:f1}")\r
// ReSharper restore CompareOfFloatsByEqualityOperator\r
};\r
ships.Add(ship);\r
ships.AddRange(equips);\r
}\r
+ var daihatsu = sniffer.GetDaihatsuBonus(f);\r
list.Add(new Record\r
{\r
Fleet = fn[f] + (levelTotal == 0 ? "" : " 合計Lv" + levelTotal) +\r
- (drumTotal == 0 ? "" : " ドラム缶" + drumTotal + "(" + drumShips + "隻)")\r
+ (drumTotal == 0 ? "" : " 缶" + drumTotal + "(" + drumShips + "隻)") +\r
+ (daihatsu > 0 ? $" 発{daihatsu * 100:f1}%" : "")\r
});\r
list.AddRange(ships);\r
}\r
});\r
list.AddRange(airCorps.Planes.Select(plane => new Record\r
{\r
- Equip =\r
- plane.State != 1\r
- ? plane.StateName\r
- : GenEquipString(plane.Slot, plane.Count, plane.MaxCount),\r
+ Equip = plane.State != 1 ? plane.StateName : GenEquipString(plane.Slot),\r
+ Spec = plane.State != 1 ? "" : $"+{plane.Slot.Alv} {plane.Count}/{plane.MaxCount}",\r
Color = plane.Slot.Spec.Color\r
}));\r
}\r
_table = list.ToArray();\r
}\r
\r
- private string GenEquipString(ItemStatus item, int onslot, int max)\r
+ private string GenEquipString(ItemStatus item)\r
{\r
var name = item.Spec.Name;\r
- var attr = (item.Alv == 0 ? "" : "+" + item.Alv) +\r
- (item.Level == 0 ? "" : "★" + item.Level) +\r
- (!item.Spec.IsAircraft ? "" : " " + onslot + "/" + max);\r
+ var attr = item.Level == 0 ? "" : "★" + item.Level;\r
var proposed = new Size(int.MaxValue, int.MaxValue);\r
- const int maxWidth = 180;\r
+ var maxWidth = item.Spec.IsAircraft ? 132 : 180;\r
var result = name + attr;\r
if (TextRenderer.MeasureText(result, Font, proposed).Width <= maxWidth)\r
return result;\r
- attr = " " + attr;\r
var truncated = "";\r
foreach (var ch in name)\r
{\r
CreateLabels(i);\r
}\r
\r
+ private class FleetLabels : IEnumerable<ShipLabel>\r
+ {\r
+ public ShipLabel Fleet { get; set; }\r
+ public ShipLabel Name { get; set; }\r
+ public ShipLabel Equip { get; set; }\r
+ public ShipLabel EquipColor { get; set; }\r
+ public ShipLabel Spec { get; set; }\r
+\r
+ public IEnumerator<ShipLabel> GetEnumerator() =>\r
+ ((IEnumerable<ShipLabel>)new[] {Fleet, Name, Equip, EquipColor, Spec}).GetEnumerator();\r
+\r
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();\r
+ }\r
+\r
private void CreateLabels(int i)\r
{\r
var y = 1 + LineHeight * i;\r
};\r
lbp.Scale(ShipLabel.ScaleFactor);\r
lbp.Tag = lbp.Location.Y;\r
- var labels = new[]\r
+ var labels = new FleetLabels\r
{\r
- new ShipLabel {Location = new Point(1, 2), AutoSize = true},\r
- new ShipLabel {Location = new Point(10, 2), AutoSize = true},\r
- new ShipLabel {Location = new Point(38, 2), AutoSize = true},\r
- new ShipLabel {Location = new Point(35, 2), Size = new Size(4, LabelHeight - 2)},\r
- new ShipLabel {Location = new Point(217, 2), AutoSize = true, AnchorRight = true}\r
+ Fleet = new ShipLabel {Location = new Point(1, 2), AutoSize = true},\r
+ Name = new ShipLabel {Location = new Point(10, 2), AutoSize = true},\r
+ Equip = new ShipLabel {Location = new Point(38, 2), AutoSize = true},\r
+ EquipColor = new ShipLabel {Location = new Point(35, 2), Size = new Size(4, LabelHeight - 2)},\r
+ Spec = new ShipLabel {Location = new Point(217, 2), AutoSize = true, AnchorRight = true}\r
};\r
_labelList.Add(labels);\r
_panelList.Add(lbp);\r
- // ReSharper disable once CoVariantArrayConversion\r
- lbp.Controls.AddRange(labels);\r
+ lbp.Controls.AddRange(labels.Cast<Control>().ToArray());\r
Controls.Add(lbp);\r
foreach (var label in labels)\r
{\r
lbp.Location = new Point(lbp.Left, (int)lbp.Tag + AutoScrollPosition.Y);\r
var e = _table[i];\r
var labels = _labelList[i];\r
- labels[0].Text = e.Fleet;\r
- labels[1].SetName(e.Ship);\r
- labels[2].Text = e.Equip;\r
- labels[3].Visible = e.Equip != "";\r
- labels[3].BackColor = e.Color;\r
- labels[4].Text = e.Spec;\r
+ labels.Fleet.Text = e.Fleet;\r
+ labels.Name.SetName(e.Ship);\r
+ labels.Equip.Text = e.Equip;\r
+ labels.EquipColor.Visible = e.Equip != "";\r
+ labels.EquipColor.BackColor = e.Color;\r
+ labels.Spec.Text = e.Spec;\r
if (e.Fleet != "" && e.Fleet2 != "")\r
- _toolTip.SetToolTip(labels[0], e.Fleet2);\r
- _toolTip.SetToolTip(labels[2], e.AircraftSpec != "" ? e.AircraftSpec : "");\r
- _toolTip.SetToolTip(labels[4], e.Spec2 != "" ? e.Spec2 : "");\r
+ _toolTip.SetToolTip(labels.Fleet, e.Fleet2);\r
+ _toolTip.SetToolTip(labels.Equip, e.AircraftSpec != "" ? e.AircraftSpec : "");\r
+ _toolTip.SetToolTip(labels.Spec, e.Spec2 != "" ? e.Spec2 : "");\r
lbp.Visible = true;\r
}\r
\r